Made smt pad offsets work by forking the generator repo
This commit is contained in:
@@ -175,7 +175,6 @@ SaveBoard("test/test.kicad_pcb", pcb)
|
||||
final_model_path = sys.path[0] + "/../../libs/melon3d/" + foot_path + ".3dshapes/" + foot_name + ".step"
|
||||
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 + " test/test.kicad_pcb")
|
||||
|
||||
|
||||
# Generate footprint
|
||||
|
||||
sys.path.append(os.path.join(sys.path[0],"../kicad-footprint-generator"))
|
||||
@@ -217,6 +216,8 @@ for [foot, pad_map] in sorted_foots:
|
||||
curr_pad_num = pad.GetNumber()
|
||||
attr_type = pad.GetAttribute()
|
||||
shape_type = pad.GetShape()
|
||||
offset = pad.GetOffset()
|
||||
|
||||
|
||||
pad_type = Pad.TYPE_THT
|
||||
pad_layers = Pad.LAYERS_THT
|
||||
@@ -250,12 +251,14 @@ for [foot, pad_map] in sorted_foots:
|
||||
elif shape_type == pcbnew.PAD_SHAPE_CUSTOM:
|
||||
pad_shape = Pad.SHAPE_CUSTOM
|
||||
for d in foot.GraphicalItems():
|
||||
print("Item: ", d)
|
||||
if type(d) is PCB_TEXT and "User.Drawings" in d.GetLayerName():
|
||||
if type(d) is pcbnew.FP_TEXT and "User.Drawings" in d.GetLayerName():
|
||||
txt_sp = d.GetText().split(':',1)
|
||||
if pad_number != txt_sp[0]:
|
||||
continue
|
||||
primitives.append(exec(txt_sp[1]))
|
||||
print("Item:", txt_sp[1].strip())
|
||||
exec("tmp = " + txt_sp[1].strip())
|
||||
primitives.append(tmp)
|
||||
# primitives.append(Arc(center=[0, 0], start=[-2.95, 0], width=1.5, angle=360, layer='F.Cu'))
|
||||
|
||||
# print(dir(pad.GetPrimitives()))
|
||||
# for prim in pad.GetPrimitives():
|
||||
@@ -265,9 +268,11 @@ for [foot, pad_map] in sorted_foots:
|
||||
if len(pad_number) > 0:
|
||||
pad_number = pad_cnt + int(pad_map[curr_pad_num])
|
||||
|
||||
final_pad = Pad(number=pad_number, type=pad_type, shape=pad_shape, at=list(cent), size=list(pad_size), drill=list(drill_size), layers=pad_layers)
|
||||
for prim in primitives:
|
||||
final_pad.addPrimitive(prim)
|
||||
# primitives = [Arc(center=[0, 0], start=[-2.95, 0], width=1.5, angle=360, layer='F.Cu')]
|
||||
print("offset: ", [ToMM(offset.x), ToMM(offset.y)])
|
||||
final_pad = Pad(number=pad_number, type=pad_type, shape=pad_shape, at=list(cent), size=list(pad_size), drill=list(drill_size), offset=list(ToMM(offset)), layers=pad_layers, primitives=primitives)
|
||||
# for prim in primitives:
|
||||
# final_pad.addPrimitive(prim)
|
||||
kicad_mod.append(final_pad)
|
||||
real_pads += len(pad.GetNumber()) > 0
|
||||
pad_cnt += real_pads
|
||||
|
||||
Reference in New Issue
Block a user