BlinkenArea - GitList
Repositories
Blog
Wiki
partlib
Code
Commits
Branches
Tags
Search
Tree:
00e203f
Branches
Tags
master
stefan.experimental
partlib
pcb_footpr_conv
fp2dxf.py
DXF export of pins + holes
Stefan Schuermans
commited
00e203f
at 2021-02-17 19:13:39
fp2dxf.py
Blame
History
Raw
#! /usr/bin/env python3 import dxf_export import pcb_parser import pcb_types import argparse import sys def parse_args(): parser = argparse.ArgumentParser('Convert GNU PCB footrpint to DXF.') parser.add_argument('-ifp', '--in-footprint', required=True, help='GNU PCB footprint file (input, required)') parser.add_argument('-odxf', '--out-dxf', required=True, help='DXF file (output, required)') args = parser.parse_args() return args def read_footprint(file_name: str) -> pcb_types.Element: with open(file_name, 'r') as f: s = f.read() parser = pcb_parser.PcbFootprintParser(s) element = parser.parseElementBlock() return element def write_dxf(fp: pcb_types.Element, file_name: str): dfw = dxf_export.DxfFootprintWriter() dfw.drawFootprint(fp) dfw.writeDxf(file_name) def main(): args = parse_args() fp = read_footprint(args.in_footprint) write_dxf(fp, args.out_dxf) if __name__ == '__main__': main()