phil1
August 18, 2022, 4:22pm
1
Hi,
anyone knows how to python a list of components so I can check the footprint names ?
for module in board.modules:
print("* Module: {} at {}".format(module.reference, module.position))
AttributeError: 'BOARD' object has no attribute 'modules'
comming from the doc : List PCB Entities — KiCad 0.1 documentation
thx for your help
eelik
August 18, 2022, 5:13pm
2
That documentation must the the experimental one for the new planned API. I think originally @pointhi made it, but I have no idea if the doc reflects the current state of the API which has not been published at all yet.
This is why I dont like readthedocs.io .
phil1
August 18, 2022, 5:51pm
3
so…how do I fix this ?
listing all components should not be something that cryptic and secret I guess
I have no idea what that readthedocs API is, but it isn’t KiCad official, nor does it reflect some unreleased API that we are working on.
The official docs live at KiCad Pcbnew Python Scripting: pcbnew Namespace Reference
This is linked from PcbNew Plugins | Developer Documentation | KiCad
Hint: It’s called FOOTPRINT not MODULE these days, so if you are finding example code using MODULE, it won’t run in 6.x or above
phil1
August 18, 2022, 6:00pm
5
I can list footprints, but there is no GetName() function, I tried a couple of functions, but I cannot find the name of the footprint itself
for fp in board.GetFootprints():
if "keycap" in fp.GetValue():
wx.LogMessage(fp.GetValue()+" has keycap")
If you’re just wanting to see the footprints and Not make a plugin then, just use the simplified BOM tool
File > Fabrication_Outputs > BOM
or, use one of the scripted BOM’s in Kicad
eelik
August 18, 2022, 6:31pm
7
It points to https://github.com/pointhi/kicad-python , the beginning of the new API in its early stage some years ago. I don’t know if it was used as the base for later development.
phil1
August 18, 2022, 6:48pm
8
yep all my keys are there
yet one the other components inherit of the same footprint…this is clearly a bug, and not an easy one to reproduce
and here is the culprit, and it’s not in the bom
in the schematic editor, it’s not the same packages
and since I upgraded from v5->v6 I get weird errors of KISYS3DMOD missing too
(post your file. But, problem may be this: Sometimes when I link a Footrpint, I mess up and add two of them in the panel… worth checking it…)
phil1
August 18, 2022, 6:54pm
10
wish I could share but it’s copyrighted and represent months of work and research and debugging
thought I got rid of these red errors thou
phil1
August 18, 2022, 7:01pm
11
and as I update all footprints, it gets back so it must be in the library itself
I update OSX and Kicad a few months ago and had zillions of problems. Still working through and updating links in older projects with the same problem you have…
phil1
August 18, 2022, 7:36pm
13
yeah this is annoying as hell
phil1
August 18, 2022, 8:49pm
14
I dont know why but “updating footprint from library” is removing my 3D objects on some components
Ugh CRUD !! I had a usb connector and a bloody barrel jack here…
system
Closed
November 16, 2022, 8:49pm
15
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.