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