Editing Footprints using python

So I like to create my footprints with the value field suppressed so it doesn’t get super crowded when laying out the PCB. A lot fo the default Kicad components don’t do this, which is fine. But I unfortunately didn’t notice this until I was done with my schematic.

So now I need to either create a new footprint for the kicad components that I am using and then change all of the parts in my schematic, which in my opinion is the right way to do it. However I would like to be able to use something similar to the global find option in Altium, which from this post sounds like Kicad developers plan on solving this issue with python scripting, which I think is a fabulous solution. Some people may be looking for a GUI tool, but for those who have experience with python it is great. It is also easy to modify an existing python script someone else wrote. However this functionality doesn’t exist yet.

Option two, is that I could use python scripting in PCBnew, which does exist, to make all of the value fields for all of the parts invisible. I need a little help in order to figure this out though. I found this doxygen page, but it isn’t filled out, which is a shame. I am not sure if the kicad developers adopted doxygen after the started coding the python section or not, but seeing Kicad developers have a hard time finding resources to document, doxygen is an easy way to do that within the source code! But that is neither here nor there, Is there a good place to go to learn how to use python scripting in PCBnew? What I am trying to do seems like it would be trivial, but I don’t even know how to run a python script for PCBnew. Help a fellow EE out please!


If a lowly bash-script is good enough for you, this does the job as well (per directory, not recursively).

for FILE in `ls *.kicad_mod`; do TMP=`mktemp` && cat $FILE | sed 's/\(.*(fp_text\ value.*)\)/\1 hide/' > $TMP && mv $TMP $FILE; done

That is exactly the thing I was looking for but couldn’t find!


Unfortunately I am using windows, but this code helps me to iron out the python code!

Thank you Sir!!
You solved a problem that have annoyed me for years.