Add module gerber rotations (partial)

This commit is contained in:
Andrei 2021-03-21 12:34:52 +02:00
parent 57d61100ec
commit 8dc935c2d4
3 changed files with 12 additions and 5 deletions

View File

@ -26,7 +26,10 @@ fragments = []
with open(mergePlaceFile, 'rb') as fmp:
for line in fmp:
m = line.split()
m = {"name": m[0], "x": m[1], "y": m[2], "path": config[m[0]]["Prefix"] }
name_and_rot = m[0].split('*rotated') # split the name and rotation parts
name = name_and_rot[0]
rot = name_and_rot[1] if len(name_and_rot) > 1 else "0"
m = {"name": name, "x": m[1], "y": m[2], "rot": rot, "path": config[name]["Prefix"] }
fragments.append(m)
print "* Starting merge of " + str(len(fragments)) + " board fragments..."
@ -48,8 +51,10 @@ for frag in fragments:
# convert to mm
off_x_mm = float(frag["x"]) * 25.4
off_y_mm = float(frag["y"]) * 25.4
# todo: apply module rotations
rot = float(frag["rot"])
fileName = frag["path"] + "-vrml.wrl"
print "* Adding " + frag["name"] + " (" + fileName + ")..."
print "* Adding " + frag["name"] + " (" + fileName + ") at (" + str(off_x_mm) + "," + str(off_y_mm) + "), rot=" + str(rot) + "..."
with open(fileName, 'rb') as f:
for line in f:
line = line.rstrip()

@ -1 +1 @@
Subproject commit 05200a1b2088a5b2cf72007611e07aec809dd117
Subproject commit 59e982d30fec97c33c7e26856a256eb01a2d3b78

View File

@ -186,7 +186,8 @@ print_to_file(board_cfg_path, "w", [
"[Options]",
"ExcellonLeadingZeros = 0",
"MeasurementUnits = inch",
"AllowMissingLayers = 1"])
"AllowMissingLayers = 1",
"FixedRotationOrigin = 1"])
# board gerbers
print_module("MergeOutputFiles", merged_gerber_path + "/" + board_name, board_cfg_path, 1)
@ -258,8 +259,9 @@ with open(frame_path + "/" + frame_name + "-BOM.csv", 'r') as bom_f:
# add module gerbers
module_path = "modules/" + module_name + "/" + module_rev
print_module(module_unique_name, module_path + "/" + module_name, board_cfg_path, 0)
rotated = ("*rotated" + rot) if (float(rot) != 0) else ""
# write abs. coords
print_to_file(board_place_path, "a", module_unique_name + " " + str(x_inch) + " " + str(y_inch))
print_to_file(board_place_path, "a", module_unique_name + rotated + " " + str(x_inch) + " " + str(y_inch))
append_cpl(module_path + "/" + module_name + "-CPL.csv", board_cpl, x, y, module_suffix)