Exemplo n.º 1
0
def write_trace_footprint(stream, name, description, vertices, trace_width, 
        pad_size, mirror=False):
    mirror = [1, -1][mirror]
    text_effects = SExpression('font', [SExpression('size', [1, 1]),
        SExpression('thickness', .15)])
    module = SExpression('module', [name,
        SExpression('layer', ['F.Cu']),
        SExpression('fp_text', [identifier('reference'), 'REF**'],
            [('at', [0, .5]), ('effects', text_effects), ('layer', 'F.SilkS')]),
        SExpression('fp_text', [identifier('value'), name],
            [('at', [0, -.5]), ('effects', text_effects),
                ('layer', 'F.SilkS')])])
    module.children.extend(SExpression('fp_line', [], [
        ('start', vertices[ii]), ('end', vertices[ii + 1]), ('layer', 'F.Cu'),
        ('width', trace_width)]) for ii in range(len(vertices) - 1))
    pad_offset = (pad_size - trace_width) / 2
    module.children.append(SExpression('pad', [1, identifier('smd'),
        identifier('rect')], [('at', (vertices[0][0] - pad_offset * mirror,
            vertices[0][1] + pad_offset)), ('size', [pad_size, pad_size]),
            ('layers', 'F.Cu')]))
    module.children.append(SExpression('pad', [2, identifier('smd'),
        identifier('rect')], [('at', (vertices[-1][0] - pad_offset * mirror,
            vertices[-1][1] - pad_offset)), ('size', [pad_size, pad_size]),
            ('layers', 'F.Cu')]))
    module.children.append(SExpression('descr', description))
    module.write_to_stream(stream)
Exemplo n.º 2
0
def write_trace_footprint(stream,
                          name,
                          description,
                          vertices,
                          trace_width,
                          pad_size,
                          mirror=False):
    mirror = [1, -1][mirror]
    text_effects = SExpression(
        'font', [SExpression('size', [1, 1]),
                 SExpression('thickness', .15)])
    module = SExpression('module', [
        name,
        SExpression('layer', ['F.Cu']),
        SExpression('fp_text', [identifier('reference'), 'REF**'],
                    [('at', [0, .5]), ('effects', text_effects),
                     ('layer', 'F.SilkS')]),
        SExpression('fp_text', [identifier('value'), name],
                    [('at', [0, -.5]), ('effects', text_effects),
                     ('layer', 'F.SilkS')])
    ])
    module.children.extend(
        SExpression('fp_line', [], [('start',
                                     vertices[ii]), ('end', vertices[ii + 1]),
                                    ('layer', 'F.Cu'), ('width', trace_width)])
        for ii in range(len(vertices) - 1))
    pad_offset = (pad_size - trace_width) / 2
    module.children.append(
        SExpression(
            'pad',
            [1, identifier('smd'), identifier('rect')],
            [('at', (vertices[0][0] - pad_offset * mirror,
                     vertices[0][1] + pad_offset)),
             ('size', [pad_size, pad_size]), ('layers', 'F.Cu')]))
    module.children.append(
        SExpression(
            'pad',
            [2, identifier('smd'), identifier('rect')],
            [('at', (vertices[-1][0] - pad_offset * mirror,
                     vertices[-1][1] - pad_offset)),
             ('size', [pad_size, pad_size]), ('layers', 'F.Cu')]))
    module.children.append(SExpression('descr', description))
    module.write_to_stream(stream)
Exemplo n.º 3
0
        si_prefix_format(side1*2e-3), si_prefix_format(side2*2e-3), args.turns,
        si_prefix_format(pitch*1e-3), si_prefix_format(trace_width*1e-3),
        si_prefix_format(args.frequency)))
    print('          Inductance: {}H'.format(si_prefix_format(L)))
    print('Resonant capacitance: {}F'.format(si_prefix_format(C)))
    print('                   Q: {:.1e}'.format(Q))

if args.kicad_mod is not None:
    text_effects = SExpression('font', [
        SExpression('size', [1, 1]),
        SExpression('thickness', .15)])
    module = SExpression('module', [
        'PCBAntenna', 
        SExpression('layer', ['F.Cu']),
        SExpression('fp_text', [
            identifier('reference'), 
            'REF**'], [
            ('at', [0, .5]), 
            ('effects', text_effects), 
            ('layer', 'F.SilkS')]),
        SExpression('fp_text', [
            identifier('value'), 
            'PCBAntenna'], [
            ('at', [0, -.5]), 
            ('effects', text_effects),
            ('layer', 'F.SilkS')])])
    module.children.extend(SExpression('fp_line', [], [
        ('start', coil[ii]), ('end', coil[ii + 1]), ('layer', 'F.Cu'),
        ('width', trace_width)]) for ii in range(len(coil) - 1))
    pad_offset = (pad_size - trace_width) / 2
    if args.shape == 'square':
Exemplo n.º 4
0
        format(si_prefix_format(side1 * 2e-3), si_prefix_format(side2 * 2e-3),
               args.turns, si_prefix_format(pitch * 1e-3),
               si_prefix_format(trace_width * 1e-3),
               si_prefix_format(args.frequency)))
    print('          Inductance: {}H'.format(si_prefix_format(L)))
    print('Resonant capacitance: {}F'.format(si_prefix_format(C)))
    print('                   Q: {:.1e}'.format(Q))

if args.kicad_mod is not None:
    text_effects = SExpression(
        'font', [SExpression('size', [1, 1]),
                 SExpression('thickness', .15)])
    module = SExpression('module', [
        'PCBAntenna',
        SExpression('layer', ['F.Cu']),
        SExpression('fp_text', [identifier('reference'), 'REF**'],
                    [('at', [0, .5]), ('effects', text_effects),
                     ('layer', 'F.SilkS')]),
        SExpression('fp_text', [identifier('value'), 'PCBAntenna'],
                    [('at', [0, -.5]), ('effects', text_effects),
                     ('layer', 'F.SilkS')])
    ])
    module.children.extend(
        SExpression('fp_line', [], [('start', coil[ii]), (
            'end', coil[ii + 1]), ('layer', 'F.Cu'), ('width', trace_width)])
        for ii in range(len(coil) - 1))
    pad_offset = (pad_size - trace_width) / 2
    if args.shape == 'square':
        pads = [(1, (coil[0][0] - pad_offset * args.mirror,
                     coil[0][1] + pad_offset), 'rect'),
                (2, (coil[-1][0] - pad_offset * args.mirror,