def smdRectPad(self, module, size, pos, name): pad = pcbnew.PAD(module) pad.SetSize(size) pad.SetShape(pcbnew.PAD_SHAPE_RECT) pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD) pad.SetLayerSet(pad.SMDMask()) pad.SetPos0(pos) pad.SetPosition(pos) pad.SetName(name) return pad
def npth(self, diameter, x, y): """put a npth in pcb with given diameter and location""" module = pcbnew.FOOTPRINT(self.pcb) npth = pcbnew.PAD(module) npth.SetAttribute(pcbnew.PAD_ATTRIB_NPTH) npth.SetShape(pcbnew.PAD_SHAPE_CIRCLE) npth.SetSize(pcbnew.wxSizeMM(diameter, diameter)) npth.SetDrillShape(pcbnew.PAD_DRILL_SHAPE_CIRCLE) npth.SetDrillSize(pcbnew.wxSizeMM(diameter, diameter)) module.Add(npth) self.pcb.Add(module) loc = pcbnew.wxPointMM(x, y) module.SetPosition(loc)
def NPTHRoundPad(self, drill): """! A round non-plated though hole (NPTH) @param drill: the drill diameter (equals the NPTH diameter) """ pad = pcbnew.PAD(self.module) pad.SetSize(pcbnew.wxSize(drill, drill)) pad.SetShape(pcbnew.PAD_SHAPE_CIRCLE) pad.SetAttribute(pcbnew.PAD_ATTRIB_HOLE_NOT_PLATED) pad.SetLayerSet(pad.UnplatedHoleMask()) pad.SetDrillSize(pcbnew.wxSize(drill, drill)) return pad
def SMDPad(self, Vsize, Hsize, shape=pcbnew.PAD_SHAPE_RECT, rot_degree=0): """ Create a surface-mount pad of the given size and shape @param Vsize: the vertical size of the pad @param Hsize: the horizontal size of the pad @param drill: the drill diameter @param shape: the shape of the pad @param rot_degree: the pad rotation, in degrees """ pad = pcbnew.PAD(self.module) pad.SetSize(pcbnew.wxSize(Hsize, Vsize)) pad.SetShape(shape) pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD) pad.SetLayerSet(pad.SMDMask()) pad.SetOrientation(rot_degree*10) # rotation is in 0.1 degrees return pad
def THPad(self, Vsize, Hsize, drill, shape=pcbnew.PAD_SHAPE_OVAL, rot_degree = 0): """! A basic through-hole pad of the given size and shape @param Vsize: the vertical size of the pad @param Hsize: the horizontal size of the pad @param drill: the drill diameter @param shape: the shape of the pad @param rot_degree: the pad rotation, in degrees """ pad = pcbnew.PAD(self.module) pad.SetSize(pcbnew.wxSize(Hsize, Vsize)) pad.SetShape(shape) pad.SetAttribute(pcbnew.PAD_ATTRIB_PTH) pad.SetLayerSet(pad.PTHMask()) pad.SetDrillSize(pcbnew.wxSize(drill, drill)) pad.SetOrientation(rot_degree*10) # rotation is in 0.1 degrees return pad
def _drawQrPixel(self, xposition, yposition): # build a rectangular pad as a dot on copper layer, # and a polygon (a square) on silkscreen if self.UseCu: pad = pcbnew.PAD(self.module) pad.SetSize(pcbnew.wxSize(self.X, self.X)) pad_pos = pcbnew.wxPoint(xposition, yposition) pad.SetPosition(pad_pos) pad.SetPos0(pad_pos) pad.SetShape(pcbnew.PAD_SHAPE_RECT) pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD) pad.SetName("") layerset = pcbnew.LSET() layerset.AddLayer(pcbnew.F_Cu) pad.SetLayerSet(layerset) self.module.Add(pad) if self.UseSilkS: polygon = self.drawPixelSquareArea(pcbnew.F_SilkS, self.X, xposition, yposition) self.module.Add(polygon)