def __init__(self, density, alternativeLibName, h=2.54, name="", mount=False):
     """
     density: "L" - least, "N" - nominal, "M" - most
     """
     if mount:
         mntString="_M"
     else:
         mntString=""
     if not name:
         name="Oled128x64%s_%1.2f%s" %( mntString,h, density)
     super().__init__(1, 4, density, name, alternativeLibName, pinLength=h+6,\
         bodyHeight=h)
     self.movePrimitives([0,12.1],90)
     # body
     self.addSimple3Dbody([0,0,h], [27.8,27.8,1], file="cube_green")
     self.addSimple3Dbody([0,0,h+1], [27,19.5,1.3])
     self.addCourtyardAndSilk([27.8,27.8], defaults.court[density])
     for x in [-1,1]:
         for y in [-1,1]:
             self.addCylinder3Dbody([23.3/2*x,23.7/2*y,h-0.05], [3.5, 3.5, 1.1],\
                 file="cylinder_metal", draw=False)
         if mount:
             self.primitives.append(pcbThtPad([23.3/2*x,-23.7/2], [5,5], 2.5, "0"))
     # transplant some parts - for fun and profit
     for y in [-13,-11,-7,-5,-1,1,3,5,7,9,11,13]:
         donor=footprintSmdChip("0603","N","")
         donor.movePrimitives([0.87*y,-0.1, h],[0,180,90])
         self.primitives.extend(donor.get3DBody())
    def __init__(self, name="", diodeType="", footprint="", refDes=defaults.diodeRefDes,\
    pins=[], dual=""):
        if not name:
            name = "diode%s%s%s%s" % ("_" if diodeType else "", diodeType,\
                "_dual_" if dual else "", dual)
        super().__init__(name, refDes)
        defaultPins={"SOT23":[1,3,2],"SMA":[2,1], "SMB":[2,1], "SMC":[2,1]}
        if not footprint and dual:
            footprint = "SOT23"
        if not pins:
            if footprint:
                pins=defaultPins[footprint]
            else:
                pins=[2,1]
        self.log.debug("New diode: \"%s\", pins: %s, footprint: %s, dual: %s" %\
            (name, pins, footprint, dual))
        self.symbols.append(symbolDiode(diodeType=diodeType, pins=pins, dual=dual, refDes=refDes))
        footprintGenerated=False
        for density in ["N", "L", "M"]:
            defaultFootprints=["SMA", "SMB", "SMC"]
            if footprint=="" or footprint in defaultFootprints:
                for fp in defaultFootprints:
                    if footprint=="" or footprint==fp:
                        self.footprints.append(footprintSmdChip(\
                            size = fp, density = density, alternativeLibName = "niceSemiconductors",\
							body="R"))
                footprintGenerated=True
            if footprint == "SOT23" or footprint=="":
                self.footprints.append(footprintSot23(density=density))
                footprintGenerated=True
            if footprint == "SOD-323" or footprint=="":
                self.footprints.append(footprintSod323(density=density))
                footprintGenerated=True
            if not footprintGenerated:
                raise ValueError("Invalid footprint %s" % footprint)
 def __init__(self, density, alternativeLibName, h=2.54, name=""):
     """
     density: "L" - least, "N" - nominal, "M" - most
     """
     if not name:
         name="DcDcDsun3A_%1.2f%s" %(h, density)
     super().__init__(name, alternativeLibName)
     # pins - transplant some pinheaders
     pinNames=[[1,2],[3,2]]
     for x in [0,1]:
         for y in [0,1]:
             donor = footprintPinheader(1,2,density=density, textOnSilk=False,\
                 pinLength=h+6, bodyHeight=h)
             donor.renamePads([pinNames[x][y]]*2)
             donor.movePrimitives([mil(365)*(x*2-1),mil(210)*(y*2-1)])
             self.primitives.extend(donor.primitives)
     # body
     self.addSimple3Dbody([0,0,h], [mil(870),mil(660),1], file="cube_green")
     self.addCourtyardAndSilk([mil(870),mil(660)], defaults.court[density])
     self.addSimple3Dbody([mil(140),mil(60),h+1], [7,7,2.8], draw=False)
     self.addSimple3Dbody([mil(150),mil(-250),h+1], [3.5, 3, 1.9], draw=False)
     self.addCylinder3Dbody([mil(150),mil(-250),h+2.9], [2.5, 2.5, 0.1],\
         file="cylinder_metal", draw=False)
     # transplant some parts - for fun and profit
     for x in [-1,1]:
         donor=footprintSmdChip("1206","N","")
         donor.movePrimitives([mil(365)*x,0,h+1], 90)
         self.primitives.extend(donor.get3DBody())
     for y in range(4):
         donor=footprintSmdChip("0603","N","")
         donor.movePrimitives([mil(-275), mil(-235)+mil(115)*y, h+1], 90)
         self.primitives.extend(donor.get3DBody())
     for x in range(2):
         donor=footprintSmdChip("0603","N","")
         donor.movePrimitives([mil(60)+mil(150)*x, mil(-140), h+1])
         self.primitives.extend(donor.get3DBody())
         for y in range(2):
             donor=footprintSmdChip("0603","N","")
             donor.movePrimitives([mil(-175)+mil(125)*x, mil(-260)+mil(60)*y, h+1])
             self.primitives.extend(donor.get3DBody())
     donor=footprintSoic(8)
     donor.movePrimitives([mil(-140),0,h+1])
     self.primitives.extend(donor.get3DBody())
     donor=footprintSmdChip("SMA","N","",body="R")
     donor.movePrimitives([mil(-155),mil(220),h+1],180)
     self.primitives.extend(donor.get3DBody())