def chip(size, polarized=False, profile=ipc.LandPatternSize.Nominal): t, n, s = size desc = '{0} ({1}) {2}chip device'.format(n, t, 'polarized ' if polarized else '') f = fp.Footprint(name=n, description=desc) c = lib.chip(profile, s, polarized) f.from_ipc(c) return f
def testFootprint(self): f = fp.Footprint(name='test') self.assertSExpr( str(f), '''(module test (layer F.Cu) (tedit 0) (at 0 0) (descr "") (fp_text reference "REF" (at 0 -1) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15)))) (fp_text value "VAL" (at 0 1) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15)))) )''') f.name = 'foo' f.description = 'A test footprint' self.assertSExpr( str(f), '''(module foo (layer F.Cu) (tedit 0) (at 0 0) (descr "A test footprint") (fp_text reference "REF" (at 0 -1) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15)))) (fp_text value "VAL" (at 0 1) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15)))) )''') f.refdes.layer = fp.Layer.BottomSilkscreen f.value.hidden = True self.assertSExpr( str(f), '''(module foo (layer F.Cu) (tedit 0) (at 0 0) (descr "A test footprint") (fp_text reference "REF" (at 0 -1) (layer B.SilkS) (effects (font (size 1 1) (thickness 0.15)))) (fp_text value "VAL" (at 0 1) (layer F.Fab) hide (effects (font (size 1 1) (thickness 0.15)))) )''') f.features.append(fp.Text(text='test feature')) self.assertSExpr( str(f), '''(module foo (layer F.Cu) (tedit 0) (at 0 0) (descr "A test footprint") (fp_text reference "REF" (at 0 -1) (layer B.SilkS) (effects (font (size 1 1) (thickness 0.15)))) (fp_text value "VAL" (at 0 1) (layer F.Fab) hide (effects (font (size 1 1) (thickness 0.15)))) (fp_text user "test feature" (at 0 0) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15)))) )''')
def test_point(size): f = fp.Footprint(name='Test Point {0}mm'.format(size)) f.features = [fp.TestPad(name=1, size=(size, size))] return f
def QFN(A, T, W, pitch, num_pins, profile=ipc.LandPatternSize.Nominal): f = fp.Footprint(name='{0}-QFN'.format(num_pins), description='{0}-pin Quad Flat No-Leads'.format(num_pins)) f.from_ipc(lib.QFN(profile, A, T, W, pitch, num_pins)) return f
def SC70(num_pins, profile=ipc.LandPatternSize.Nominal): f = fp.Footprint(name='SC70-{0}'.format(num_pins)) f.from_ipc(lib.SC70(profile, num_pins)) return f
def SOP(A, B, L, T, W, num_pins, pitch, profile=ipc.LandPatternSize.Nominal): f = fp.Footprint(name='{0}-SOP'.format(num_pins), description='{0}-pin SOP'.format(num_pins)) f.from_ipc(lib.SOP(profile, A, B, L, T, W, num_pins, pitch)) return f