コード例 #1
0
 def testChips(self):
     for k in lib._chip_metric_dimensions.keys():
         for p, n in self.PROFILES.items():
             for polarized in (True, False):
                 name = 'chip_m_%s_%s' % (k, n)
                 name += 'P' if polarized else ''
                 fp = lib.chip(p, lib.metric(k), polarized)
                 self._check_svg(name, fp)
     for k in lib._chip_imperial_dimensions.keys():
         for p, n in self.PROFILES.items():
             for polarized in (True, False):
                 name = 'chip_i_%s_%s' % (k, n)
                 name += 'P' if polarized else ''
                 fp = lib.chip(p, lib.imperial(k), polarized)
                 self._check_svg(name, fp)
コード例 #2
0
from kidraw import footprint as fp
from kidraw import ipc
from kidraw.ipc import library as lib

metric = lambda s: ('metric', s, lib.metric(s))
imperial = lambda s: ('imperial', s, lib.imperial(s))

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 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 SOIC(A, B, L, T, W, num_pins, pitch=1.27, profile=ipc.LandPatternSize.Nominal):
    f = fp.Footprint(name='{0}-SOIC'.format(num_pins),
                     description='{0}-pin SOIC'.format(num_pins))
    f.from_ipc(lib.SOIC(profile, A, B, L, T, W, num_pins, pitch))
    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
コード例 #3
0
ファイル: test_card.py プロジェクト: gaensli/kidraw
    ipc.LandPatternSize.Most: 'M',
    ipc.LandPatternSize.Nominal: 'N',
    ipc.LandPatternSize.Least: 'L',
}

fps = []
for p, l in PROFILE.items():
    fps.extend([
        ('32-TQFP-'+l, tqfp(p)),
        ('24-QFN-'+l, qfn(p)),
        ('20-PQFN-'+l, pqfn(p)),
        ('8-DFN-'+l, dfn(p)),
        ('8-SOIC-'+l, soic(p)),
        ('16-SSOP-'+l, ssop(p)),
        ('8-SC70-'+l, sc70(p)),
        ('12-TSOPJ-'+l, tsopj(p)),
    ])
    for polarized in (True, False):
        pol = 'P' if polarized else ''
        for s in ('0402', '0603', '0805', '1206'):
            fps.append(('{0}-{1}-{2}'.format(s, pol, l),
                        lib.chip(p, lib.imperial(s), polarized)))
        fps.append(('SOD-%s-%s' % (pol, l), SOD(p, polarized)))
        fps.append(('Molded-%s-%s' % (pol, l), Molded(p, polarized)))
        fps.append(('MELF-%s-%s' % (pol, l), MELF(p, polarized)))
    for s in (3, 5, 6, 8):
        fps.append(('SOT23-{0}'.format(s), lib.SOT23(p, s)))

with open('card.svg', 'w') as f:
    f.write(binpack([(n, x.scale(30)) for n, x in fps], w=1200))