I’m experimenting with Python and KiCAD. For documentation, is there a better source than this: KiCad Pcbnew Python Scripting: Main Page ?
On to the question.
My SMD footprints for passive compontents are the same for resistor, capacitor and inductor. The 3D models are included for the 3 components in 1 footprint. Now instead of selecting manually which model to show, I’m writing a little script to select the correct one automatically. This is what I have now:
def select_correct_3d_model(footprint) -> None:
reference = footprint.GetReference()
show = ""
if reference[0] == "R":
show = "Resistor"
elif reference[0] == "C":
show = "Capacitor"
elif reference[0] == "L":
show = "Inductor"
else:
print(f"{reference}: untouched, has {len(footprint.Models())} 3d models")
return
for model in footprint.Models():
if show in model.m_Filename:
model.m_Show = True
print(f"{reference}: selected {model.m_Filename}")
else:
model.m_Show = False
My problem:
I can’t seem to set model.m_Show
to False. How to do this? Where can I find the setters for this attribute?