FEAT: added DWN, CHK, APP to templates, added hfs template.
This commit is contained in:
@@ -42,7 +42,8 @@ for item in pcb.GetDrawings():
|
||||
foot_path = lines[2].split(":")[-1].strip()
|
||||
if not lines[3].startswith("Z:"):
|
||||
continue
|
||||
z_offset = float(lines[3].split(":")[-1].strip())
|
||||
z_str = lines[3].split(":")[-1].strip()
|
||||
z_offset = eval(z_str)
|
||||
for line in lines[4:]:
|
||||
sp = line.split(':', 1)
|
||||
if len(sp) != 2:
|
||||
@@ -53,14 +54,17 @@ for item in pcb.GetDrawings():
|
||||
foot = foot_sp[0].strip()
|
||||
offset = (0,0)
|
||||
# Optional offset tuple
|
||||
if len(foot_sp) == 2:
|
||||
if len(foot_sp) > 1:
|
||||
print("Foot sp: ", foot_sp)
|
||||
offset = foot_sp[1].strip(" ()").split(',')
|
||||
print("Offset: ", offset)
|
||||
offset[0] = FromMM(float(offset[0]))
|
||||
offset[1] = FromMM(float(offset[1]))
|
||||
disable_model = False
|
||||
if len(foot_sp) > 2:
|
||||
disable_model = eval(foot_sp[2])
|
||||
|
||||
new_foots[ref] = [foot, offset]
|
||||
new_foots[ref] = [foot, offset, disable_model]
|
||||
# pins = sp[1]
|
||||
# pin_refs = []
|
||||
# for pin in pins.split(','):
|
||||
@@ -126,6 +130,9 @@ for foot in saved:
|
||||
cent_diff = orig_cent - new_cent
|
||||
load_foot.SetX(load_foot.GetX() + cent_diff.x + vals[1][0])
|
||||
load_foot.SetY(load_foot.GetY() + cent_diff.y + vals[1][1])
|
||||
# Disable model if applicable
|
||||
if vals[2]:
|
||||
load_foot.Models().clear()
|
||||
# Flip the net assignments of the pads
|
||||
pad_map = {}
|
||||
for pad in load_foot.Pads():
|
||||
@@ -161,7 +168,7 @@ for foot in saved:
|
||||
# sorted_foots.sort(key=lambda foot: foot[0].GetY())
|
||||
|
||||
# Export the step file
|
||||
os.system("kicad-cli pcb export vrml --units 'tenths' -f --user-origin " + str(ToMM(brd_cent.x)) + "x" + str(ToMM(brd_cent.y)) + "mm -o /tmp/dummy.wrl " + sys.argv[1])
|
||||
# Export step file of board with no additional components
|
||||
os.system("kicad-cli pcb export step -f --subst-models --user-origin " + str(ToMM(brd_cent.x)) + "x" + str(ToMM(brd_cent.y)) + "mm -o /tmp/dummy.stp " + sys.argv[1])
|
||||
|
||||
# Import the 3d model of the actual PCB
|
||||
@@ -179,9 +186,13 @@ pcb.Add(dummy)
|
||||
|
||||
# Save and export step of board + mating connectors
|
||||
SaveBoard("test/test.kicad_pcb", pcb)
|
||||
<<<<<<< HEAD
|
||||
final_model_path = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".wrl"
|
||||
final_model_path_stp = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".stp"
|
||||
os.system("kicad-cli pcb export vrml -f --units 'tenths' --user-origin " + str(ToMM(brd_cent.x)) + "x" + str(ToMM(brd_cent.y)) + "mm -o " + final_model_path + " test/test.kicad_pcb")
|
||||
=======
|
||||
final_model_path_stp = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".stp"
|
||||
>>>>>>> dev
|
||||
os.system("kicad-cli pcb export step -f --subst-models --user-origin " + str(ToMM(brd_cent.x)) + "x" + str(ToMM(brd_cent.y)) + "mm -o " + final_model_path_stp + " test/test.kicad_pcb")
|
||||
|
||||
# Generate footprint
|
||||
|
||||
Reference in New Issue
Block a user