I’m creating some symbol libraries and some footprints for a custom components I have. On libraries I’m adding some custom fields like for example the Tolerance, Code… and I want to show some of these custom fields on my Footprints because I don’t want to create a footprint for every component value (I’ve automatized the process using python, but they are near 6000 files).
For now I know that there are text like “%R”, “%V”, “REF**” and “VAL**”, but after a few days searching I’m not able to find the way to do it, so maybe even doesn’t exists.
Here’s an example of a component:
I just want to print custom values on my PCB like for example the Code or the Tolerance, so I want to use a variable substitution to avoid to have to create the same footprint several times just for change a text.
Not possible right now using KiCad’s own means. Only variable substitutions supported are the ones you already mentioned.
You can however write a script to do it.
Here is how I would approach this:
Modify your footprints and add a text field on appropriate layer. Set the value of that text to “%customfield%” or something unique like that.
Write a pcbnew action plugin or just a python script that will go over all footprints on the board and if it finds one with text “%customfield%” it will try to pull the right value for that reference from schematic data and substitute the value on footprint.
Now there are multiple ways to pull custom field values from schematic. One is to parse .sch file directly, another is to parse generated netlist file, yet another is to parse .xml file that eeschema generates for BOM. The latter 2 are implemented in my plugin you can use that code for reference.
I’ll try to create an script like you have suggested, because it save me a lot of files that slow down the program and are much harder to manage.
Also thanks for the links to your code, it should be a good start point.
General tip for the future: switch kicad to english before making a screenshot to be posted on an international forum (kicad main window -> preferences -> select language -> english)
I think future versions of kicad will allow the value field to be different than the symbol name. This will allow you to have a cleartext description in the value field while still having the symbol name encode the part number (so have the value as 20k, 5% and still have the symbol named CR0603JA…) With that you can then use one footprint for all fitting resistors while having the value as cleartext. No need for a script.