Created
August 26, 2018 10:51
-
-
Save qsun/2f232fa6870e3653358291d9acda4017 to your computer and use it in GitHub Desktop.
convert kicad .pos SMT file into the one JLC uses.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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