Updated neoden formatting script
This commit is contained in:
@@ -17,19 +17,26 @@ YY1_FEEDER_IND = YY1_COMP_HEADER.index("FeederNo") - YY1_EXTRA_IND
|
||||
|
||||
YY1_DEF_EXTRA = [0, 0, 50, 0.0, 0.0, 1, 0]
|
||||
|
||||
KI_POS_SUFFIX = "-all-pos"
|
||||
KI_POS_SUFFIX = "_cpl"
|
||||
|
||||
pcb_dir = sys.argv[1]
|
||||
|
||||
pcb_file = glob("*.kicad_pcb")
|
||||
pcb_file = glob(pcb_dir + "/*.kicad_pcb")
|
||||
board = LoadBoard(pcb_file[0])
|
||||
sourceArea = findBoardBoundingBox(board)
|
||||
bottomOrig = [(a - b)/10**6 for a,b in zip(*[list(getOriginCoord(o, sourceArea)) for o in [Origin.BottomRight, Origin.BottomLeft]])]
|
||||
print("bottom Orig: ", bottomOrig)
|
||||
|
||||
|
||||
csv_files = glob("*.csv")
|
||||
|
||||
output_dir = deepcopy(pcb_dir)
|
||||
csv_files = glob(output_dir + "/*.csv")
|
||||
if len(csv_files) < 1:
|
||||
output_dir = "Fabrication/" + output_dir
|
||||
csv_files = glob(output_dir + "/*.csv")
|
||||
|
||||
input = next(filter(lambda f: KI_POS_SUFFIX in f, csv_files))
|
||||
output = input.split(KI_POS_SUFFIX)[0] + "-neo-pos.csv"
|
||||
output = output_dir + "/" + input.split("/")[-1].split(KI_POS_SUFFIX)[0] + "-neo-pos.csv"
|
||||
try:
|
||||
feed_opt = next(filter(lambda f: "feed" in f, csv_files))
|
||||
except:
|
||||
@@ -71,7 +78,7 @@ for f in fids:
|
||||
# Components
|
||||
comps = rows_in[1:]
|
||||
comp_feed = {}
|
||||
feeder = 0
|
||||
feeder = 1
|
||||
# Load in optional file
|
||||
if feed_opt is not None:
|
||||
# Read in feeder options for components
|
||||
@@ -140,7 +147,7 @@ for tag, origin in origins.items():
|
||||
# Format output
|
||||
rows_out = [YY1_HEADER, YY1_SEP, YY1_PANEL, YY1_SEP]
|
||||
# y is still same dir, but x gets flipped, so the x calc is opposite sign
|
||||
rows_out.append(["Fiducial","1-X", "{:.2f}".format(origin[0] - fid_pos[0]) ,"1-Y","{:.2f}".format(fid_pos[1] - origin[1]) ,"OverallOffsetX",0,"OverallOffsetY",0,])
|
||||
rows_out.append(["Fiducial","1-X", "{:.2f}".format(abs(fid_pos[0] - origin[0])) ,"1-Y","{:.2f}".format(fid_pos[1] - origin[1]) ,"OverallOffsetX",0,"OverallOffsetY",0,])
|
||||
rows_out.append(YY1_SEP)
|
||||
for _ in range(4):
|
||||
rows_out.append(YY1_NOZZLE_DEF)
|
||||
@@ -154,3 +161,5 @@ for tag, origin in origins.items():
|
||||
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||
for row in rows_out:
|
||||
spamwriter.writerow(row)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user