Added 3rd field for footprint gen, allowing you to disable the 3d model of the added footprint

This commit is contained in:
ac
2025-05-27 17:04:02 +10:00
parent 1828df591f
commit a1564dece5

View File

@@ -53,14 +53,17 @@ for item in pcb.GetDrawings():
foot = foot_sp[0].strip() foot = foot_sp[0].strip()
offset = (0,0) offset = (0,0)
# Optional offset tuple # Optional offset tuple
if len(foot_sp) == 2: if len(foot_sp) > 1:
print("Foot sp: ", foot_sp) print("Foot sp: ", foot_sp)
offset = foot_sp[1].strip(" ()").split(',') offset = foot_sp[1].strip(" ()").split(',')
print("Offset: ", offset) print("Offset: ", offset)
offset[0] = FromMM(float(offset[0])) offset[0] = FromMM(float(offset[0]))
offset[1] = FromMM(float(offset[1])) 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] # pins = sp[1]
# pin_refs = [] # pin_refs = []
# for pin in pins.split(','): # for pin in pins.split(','):
@@ -126,6 +129,9 @@ for foot in saved:
cent_diff = orig_cent - new_cent cent_diff = orig_cent - new_cent
load_foot.SetX(load_foot.GetX() + cent_diff.x + vals[1][0]) load_foot.SetX(load_foot.GetX() + cent_diff.x + vals[1][0])
load_foot.SetY(load_foot.GetY() + cent_diff.y + vals[1][1]) 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 # Flip the net assignments of the pads
pad_map = {} pad_map = {}
for pad in load_foot.Pads(): for pad in load_foot.Pads():