Exemple #1
0
 def parse_line(self, package, line):
     t = line.split()
     if t[0] == "Po":
         return
     elif t[0] == "Li":
         return
     elif t[0] == "Cd":
         return
     elif t[0] == "Sc":
         return
     elif t[0] == "AR":
         return
     elif t[0] == "Op":
         return
     elif t[0][:1] == "T":
         return
     elif t[0] == "DS":
         t = line.split()
         start = (self.dim(t[1]), self.dim(t[2]))
         end = (self.dim(t[3]), self.dim(t[4]))
         package.data.append(Line( start, end, self.dim(t[5]) ))
         package.expand_bbox(start)
         package.expand_bbox(end)
         #line.layer = t[6]
     elif t[0] == "$PAD":
         pad = Pad()
         package.data.append(pad)
         
         for line in self.f:
             t = line.split()
             if t[0] == "Sh":
                 pad.xsize = self.dim(t[3])
                 pad.ysize = self.dim(t[4])
                 pad.rotation = float(t[7]) / 10.0
             elif t[0] == "Dr":
                 pass
             elif t[0] == "At":
                 pass
             elif t[0] == "Ne":
                 pass
             elif t[0] == "Po":
                 pad.x = self.dim(t[1])
                 pad.y = self.dim(t[2])
             elif t[0] == "$EndPAD":
                 maxdim = max(pad.xsize, pad.ysize) / 2.0
                 package.expand_bbox((pad.x - maxdim, pad.y - maxdim))
                 package.expand_bbox((pad.x + maxdim, pad.y + maxdim))
                 return
     else:
         return
Exemple #2
0
    def generate(self, **kwargs):
        """Generate data using previously loaded name and parameters. Returns a list."""
        data = []
        params = self.params
        package = Package()

        body = params.l - 2*params.termlen
        package.description = "SOP-%d, %.02fmm pitch, %.2f mm body" % (
                                                    params.pincount, params.pitch, body)
    
        l = params.l # Package lead span
        # Positions and sizes of things relative to data center
        padtoe = l / 2 + params.JT
        padheel = l / 2 - params.footlen - params.JH
        padlen = padtoe - padheel
        padcenter = padtoe - padlen / 2.0
        padwidth = params.termwidth + params.JS
        pins_per_side = params.pincount // 2
        first_pad_x = - (pins_per_side - 1) * params.pitch / 2.0
        packagew = ((pins_per_side - 1) * params.pitch + 1.0) / 2.0 # About right, for small chips
        packageh = l / 2 - params.termlen
        courtyardw = packagew + params.courtyard_excess
        courtyardh = padtoe + params.courtyard_excess
        outlinew = packagew + params.silkwidth/2.0
        outlineh = packageh + params.silkwidth/2.0

        # Draw courtyard on package layer
        rect = Rectangle( (-courtyardw, -courtyardh), (courtyardw, courtyardh))
        rect.layer = "package"
        data.append(rect)

        # Draw package size on package layer
        rect = Rectangle( (-packagew, -packageh), (packagew, packageh))
        rect.layer = "package"
        data.append(rect)
        
        # Draw outline on silkscreen
        rect = Rectangle( (-outlinew, -outlineh), (outlinew, outlineh))
        rect.width = params.silkwidth
        data.append(rect)
        marksize = 0.75
        rect = Rectangle( (-outlinew, -marksize), (-outlinew + marksize, marksize))
        rect.width = params.silkwidth
        data.append(rect)
        
        # Draw orientation marker by pin 1 on silkscreen
        markx = first_pad_x - padwidth / 2.0 - params.silkwidth * 2
        line = Line( (markx, padcenter - params.silkwidth*2), (markx, padcenter))
        line.width = params.silkwidth
        data.append(line)

        # Add pads, starting with pin 1 in lower-left (negative X, positive Y) corner
        # Pads are drawn on the bottom side and rotated into place
        pinno = 1
        for side in range(0, 2):
            th = side * 180 # Coordinate system rotation for this side
    
            # Pad center coordinates
            x = first_pad_x
            y = padcenter
    
            for pin in range(0, pins_per_side):
                pad = Pad(pinno)
                pad.x = x
                pad.y = y
                pad.ysize = padlen
                pad.xsize = padwidth
                pad.rotate(th)
    
                data.append(pad)
    
                pinno += 1
                x += params.pitch

        # All done!
        package.data = data
        package.courtyard = ((-courtyardw, -courtyardh), (courtyardw, courtyardh))
    
        return package
Exemple #3
0
    def generate(self, **kwargs):
        """Generate data using previously loaded name and parameters. Returns a list."""
        data = []
        params = self.params
        package = Package()

        package.description = "QFP-%d, %.02fmm pitch" % (
                                                    params.pincount, params.pitch)
    
        l = params.l1 # Package length along this dimension (FIXME: non-square packages)
        # Positions of things relative to data center
        padtoe = l / 2 + params.JT
        padheel = l / 2 - params.footlen - params.JH
        padlen = padtoe - padheel
        padcenter = padtoe - padlen / 2.0
        padwidth = params.termwidth + params.JS
        pins_per_side = params.pincount // 4
        first_pad_y = (pins_per_side - 1) * params.pitch / 2.0
        courtyardsize = padtoe + params.courtyard_excess
        outlinesize = l / 2 - params.termlen + params.silkwidth/2.0

        # Draw courtyard on package layer
        rect = Rectangle( (-courtyardsize, -courtyardsize), (courtyardsize, courtyardsize))
        rect.layer = "package"
        data.append(rect)

        # Draw package size on package layer
        for side in range(0, 4):
            chamfer = 0.5
            packagesize = l / 2 - params.termlen
            th = (270 + side * 90) % 360 # Coordinate system rotation for this side
            line = Line( (-packagesize + chamfer, packagesize), (packagesize - chamfer, packagesize) )
            line.layer = "package"
            line.rotate(th)
            data.append(line)
            line = Line( (packagesize - chamfer, packagesize), (packagesize, packagesize - chamfer) )
            line.layer = "package"
            line.rotate(th)
            data.append(line)

            leadblockw = pins_per_side * params.pitch / 2.0
            leadblockh = l / 2
            
            rect = Rectangle( (-leadblockw, leadblockh), (leadblockw, leadblockh - params.footlen), 0)
            rect.layer = "package"
            rect.rotate(th)
            data.append(rect)
            rect = Rectangle( (-leadblockw, leadblockh - params.footlen), (leadblockw, packagesize), 0)
            rect.layer = "package"
            rect.rotate(th)
            data.append(rect)
    
        # Draw outline on silkscreen
        linelen = outlinesize - first_pad_y - padwidth / 2 - params.silkwidth * 1.5
        for side in range(0, 4):
            th = (270 + side * 90) % 360 # Coordinate system rotation for this side
            line = Line( (-outlinesize, outlinesize), (-outlinesize + linelen, outlinesize) )
            line.width = params.silkwidth
            line.rotate(th)
            data.append(line)
            line = Line( (-outlinesize, outlinesize), (-outlinesize, outlinesize - linelen) )
            line.width = params.silkwidth
            line.rotate(th)
            data.append(line)

        # Draw orientation mark on silkscreen
        marklen = 1.0
        line = Line( (-outlinesize, outlinesize), (-outlinesize - marklen, outlinesize + marklen) )
        line.width = params.silkwidth
        data.append(line)
    
        # Add pads, starting with pin 1 in lower-left (negative X, positive Y) corner
        # Pads are drawn on the 0-degree (right) side and rotated into place
        pinno = 1
        for side in range(0, 4):
            th = (270 + side * 90) % 360 # Coordinate system rotation for this side
    
            # Pad center coordinates
            x = padcenter
            y = first_pad_y
    
            for pin in range(0, pins_per_side):
                pad = Pad(pinno)
                pad.x = x
                pad.y = y
                pad.ysize = padwidth
                pad.xsize = padlen
                pad.rotate(th)
    
                data.append(pad)
    
                pinno += 1
                y -= params.pitch

        # All done!
        package.data = data
        package.courtyard = ((-courtyardsize, -courtyardsize), (courtyardsize, courtyardsize))
    
        return package