Exemplo n.º 1
0
    def __str__(self):
        """return the kicad_mod code for this footprint"""
        mod = kicad.mod_module(self.name, self.descr)
        mod.add_tags(('DIL', 'DIP', 'PDIP', '%dmil' % kicad.mm2mil(self.w)))
        # add text: silk reference (center top)
        t = kicad.mod_text('REF**', 'reference', 'F.SilkS')
        t.set_xy((self.w / 2.0, -self.pitch))
        mod.add_shape(t)
        # add text: fab name (center bottom)
        t = kicad.mod_text(self.name, 'value', 'F.Fab')
        t.set_xy((self.w / 2.0, self.h + self.pitch))
        mod.add_shape(t)
        # add text: fab reference (center)
        t = kicad.mod_text('%R', 'user', 'F.Fab')
        t.set_xy((self.w / 2.0, self.h / 2.0))
        mod.add_shape(t)
        # add the pads
        pad_size = 1.6
        hole_size = 0.8
        for i in range(self.n):
            pad_shape = ('oval', 'rect')[i == 0]
            p = kicad.mod_pad('%d' % (i + 1), 'thru_hole', pad_shape,
                              ('*.Cu', '*.Mask'))
            p.set_size(pad_size, pad_size).set_drill(hole_size)
            p.set_xy(self.pad_xy(i))
            mod.add_pad(p)

        self.courtyard(mod)
        self.fab(mod)
        self.silk(mod)
        return str(mod)
Exemplo n.º 2
0
 def fab(self, mod):
     """add a fab layer"""
     # fab name at top left
     t = kicad.mod_text(name, 'value', 'F.Fab')
     t.set_xy((kicad.mil2mm(0), kicad.mil2mm(-3250)))
     mod.add_shape(t)
     # fab reference at top left
     t = kicad.mod_text('%R', 'user', 'F.Fab')
     t.set_xy((kicad.mil2mm(0), kicad.mil2mm(-3150)))
     mod.add_shape(t)
     # board outline
     x = (kicad.mil2mm(1300) - self.w) / 2.0
     y = kicad.mil2mm(50) - self.h
     mod.add_rect(x, y, self.w, self.h, 'F.Fab', 0.1)
Exemplo n.º 3
0
 def add_silk(self, mod):
     """add a silk layer"""
     # add connector outlines
     cw = kicad.mil2mm(200)
     ch = kicad.mil2mm(25 * 100)
     for cx, cy in (self.pad_xy(0, 0), self.pad_xy(1, 0)):
         cx -= kicad.mil2mm(50)
         cy -= kicad.mil2mm(50)
         mod.add_rect(cx, cy, cw, ch, 'F.SilkS', 0.12)
     # silk reference
     t = kicad.mod_text('REF**', 'reference', 'F.SilkS')
     t.set_xy((kicad.mil2mm(25), kicad.mil2mm(-100)))
     mod.add_shape(t)
     # silk pin 1
     t = kicad.mod_text('A1', 'user', 'F.SilkS')
     t.set_xy((kicad.mil2mm(-100), 0))
     mod.add_shape(t)
Exemplo n.º 4
0
 def silk(self, mod):
     """add a silk layer"""
     # silk reference
     t = kicad.mod_text('REF**', 'reference', 'F.SilkS')
     t.set_xy((0, kicad.mil2mm(-100)))
     mod.add_shape(t)
     # silk pin 1
     t = kicad.mod_text('1', 'user', 'F.SilkS')
     t.set_xy((kicad.mil2mm(-100), 0))
     mod.add_shape(t)
     # add the connector outlines
     ch = kicad.mil2mm(100)
     dx = kicad.mil2mm(50)
     dy = kicad.mil2mm(50)
     # large connector
     (cx, cy) = self.pad_xy(0)
     cx -= dx
     cy -= dy
     mod.add_rect(cx, cy, kicad.mil2mm(14 * 100), ch, 'F.SilkS', 0.12)
     # small connector
     (cx, cy) = self.pad_xy(14)
     cx -= dx
     cy -= dy
     mod.add_rect(cx, cy, kicad.mil2mm(4 * 100), ch, 'F.SilkS', 0.12)