Skip to content

Instantly share code, notes, and snippets.

@qsun
Created August 26, 2018 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qsun/2f232fa6870e3653358291d9acda4017 to your computer and use it in GitHub Desktop.
Save qsun/2f232fa6870e3653358291d9acda4017 to your computer and use it in GitHub Desktop.
convert kicad .pos SMT file into the one JLC uses.
import sys
import csv
import re
for filename in sys.argv[1:]:
print("Processing %s" % (filename,))
o_filename = filename + '-jlc.csv'
with open(filename, 'r') as i:
with open(o_filename, 'w') as o:
w = csv.writer(o)
print("Output to %s" % (o_filename,))
w.writerow(['Designator', 'Footprint', 'Mid X', 'Mid Y', 'Layer', 'Rotation'])
for line in i.readlines():
if line.find('#') == 0:
continue
line = line.strip()
print("Processing line: [%s]" % (line,))
[ref, val, package, pos_x, pos_y, rot, side] = re.split('\s{2,}', line)
if side == 'top':
side = 'T'
else:
side = 'B'
w.writerow([ref, package, pos_x, pos_y, side, rot])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment