Merge main into dev
This commit is contained in:
@@ -44,9 +44,6 @@ for item in pcb.GetDrawings():
|
||||
continue
|
||||
z_str = lines[3].split(":")[-1].strip()
|
||||
z_offset = eval(z_str)
|
||||
if type(z_offset) is not tuple:
|
||||
z_offset = (z_offset)
|
||||
|
||||
for line in lines[4:]:
|
||||
sp = line.split(':', 1)
|
||||
if len(sp) != 2:
|
||||
@@ -171,19 +168,15 @@ 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
|
||||
if len(z_offset) > 1:
|
||||
path = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + "_base" + ".wrl"
|
||||
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 " + path + " " + sys.argv[1])
|
||||
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
|
||||
dummy = FOOTPRINT(pcb)
|
||||
dummy.SetPosition(brd_cent)
|
||||
dummy_model = FP_3DMODEL()
|
||||
dummy_model.m_Filename = "/tmp/dummy.wrl"
|
||||
dummy_model.m_Offset = VECTOR3D(0.0, 0.0, z_offset[0])
|
||||
dummy_model.m_Offset = VECTOR3D(0.0, 0.0, z_offset)
|
||||
dummy.Add3DModel(dummy_model)
|
||||
pcb.Add(dummy)
|
||||
|
||||
@@ -193,8 +186,8 @@ pcb.Add(dummy)
|
||||
|
||||
# Save and export step of board + mating connectors
|
||||
SaveBoard("test/test.kicad_pcb", pcb)
|
||||
path = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".wrl"
|
||||
os.system("kicad-cli pcb export vrml -f --units 'mm' --user-origin " + str(ToMM(brd_cent.x)) + "x" + str(ToMM(brd_cent.y)) + "mm -o " + path + " test/test.kicad_pcb")
|
||||
final_model_path_stp = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".stp"
|
||||
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
|
||||
|
||||
@@ -265,7 +258,6 @@ for [foot, pad_map] in sorted_foots:
|
||||
# start = [cent_mm[0] - size_mm[0], cent_mm[1] - size_mm[1]]
|
||||
# end = [cent_mm[0] + size_mm[0], cent_mm[1] + size_mm[1]]
|
||||
# kicad_mod.append(RectLine(start=start, end=end, layer='F.Silkscreen', width=0.05, offset=0.2))
|
||||
|
||||
# elif shape_type == pcbnew.SHAPE_T_CIRCLE:
|
||||
# start = [cent_mm[0], cent_mm[1] + size_mm[1]/2]
|
||||
# end = [start[0], start[1]]
|
||||
@@ -427,21 +419,17 @@ for i in range(len(corners)):
|
||||
# kicad_mod.append(RectLine(start=[-brd_width/2,-brd_height/2], end=[brd_width/2,brd_height/2], layer='F.SilkS', width=0.15))
|
||||
|
||||
|
||||
output_list = [(foot_name, -1.6)]
|
||||
# Output another footprint if a second offset is specified
|
||||
if len(z_offset) > 1:
|
||||
output_list.append((foot_name+"_base", z_offset[1]))
|
||||
|
||||
for [local_name, z] in output_list:
|
||||
local_mod = deepcopy(kicad_mod)
|
||||
local_mod.append(Model(filename="${KIPRJMOD}/../libs/melon3d/" + foot_path + ".3dshapes/" + local_name + ".wrl"
|
||||
,at=[0,0,z]
|
||||
final_model_path = "${KIPRJMOD}/../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".stp"
|
||||
kicad_mod.append(Model(filename=final_model_path
|
||||
,at=[0,0,-1.6]
|
||||
,scale=[1,1,1]
|
||||
,rotate=[0,0,0]))
|
||||
|
||||
# write file
|
||||
file_handler = KicadFileHandler(local_mod)
|
||||
file_handler.writeFile(sys.path[0] + "/../../libs/melonlib/" + foot_path + ".pretty/" + local_name + ".kicad_mod" )
|
||||
# write file
|
||||
file_handler = KicadFileHandler(kicad_mod)
|
||||
final_foot_path = sys.path[0] + "/../../libs/melonlib/" + foot_path + ".pretty/" + foot_name + ".kicad_mod"
|
||||
file_handler.writeFile(final_foot_path)
|
||||
|
||||
import shutil
|
||||
|
||||
shutil.rmtree("test")
|
||||
|
||||
Reference in New Issue
Block a user