Plugin Showcase - Save/Restore Reference Positions

Hi. Long time KiCad user, but new to the forum, so apologize if this is posted in the wrong place. I’d like to showcase a simple plugin to help others with a common annoyance I had with my workflow.

I frequently update my library symbols and footprints. I pull those changes into my schematic by using the “Update Fields from Library” function then generate a new netlist which I pull into my layout.

The issue I often face is upon pulling those changes into my layout. While footprints themselves stay put reference designators may revert back to their original position and orientations. This is a huge pain to correct. So I’ve created a script to save and store reference designator positions and orientations.

To save use Tools >> External Plugins >> Reference Positions -> Save

Positions and orientations are stored within “reference-positions.json”, a file within the project directory. The JSON file stores the position of each valid reference designator and orientation.

To restore use Tools >> External Plugins >> Reference Positions -> Restore

To install the plugin, download the two Python files from GitHub below, then place in the KiCad plugins directory (on Windows C:\Program Files\KiCad\share\kicad\scripting\plugins). Restart KiCad and you’re good to go.

It would be really nice to have this functionality built-into KiCad in the future. Perhaps within the Load Netlist dialog?

Inspiration for this plugin: Update footprints, but keep position of reference designators


It appears you are still generating a netlist and then loading that netlist into Pcbnew. This has been deprecated since KiCad V5, released on 2018-07-22:

Working with separate netlists is mainly maintained as an interface to external tools (for example SKiDL).

Since then the normal way is to use: Eeschema / Tools / Update PCB from Schematic [F8] Which brings up this dialog:

Which is very similar (but strangely not identcal) to Pcbnew / Tools / Load Netlist, which looks like:

And indeed, if you have changed your footprints, and enable the checkbox Options / [x] Update footprints in this way, then probably the text locations get reset to the locations in the libraries.

Another way to update the footprints, is to not do it with the Update Pcb from Schematic dialog, but with: Pcbnew / Tools / Update Footprints from Library. Which opens the dialog:

In Update Options there are some checkboxes to remove new texts or reset text layers / positions. If you do not enable those checkboxes, texts probably stay where they are. (I have not checked) I think this is very similar to what your plugin does.

What do you mean with “may” in:

When text positions revert to library positions when they should not, it is a bug which should be reported on gitlab. If a bug is suspected, then start by checking (and updating if needed) your KiCad installation. Current is V5.1.9. (With suspected bugs, always post full version info, which is about 20 lines of text you can copy from the About box.

You’re right, using “Update PCB from Schematic” is the modern way, but I’m old school. I just like using netlists. Thankfully I’ve read netlists will be supported in KiCad 6.

Anyway, this being said, I just tried it out both ways and the result is the same. As you mentioned, if the footprint name changes then the reference designator’s position and orientation will reset. Unfortunately “Update Footprints from Library” is only useful if the footprint name remains constant. I tend to rename my symbols and footprints all the time (still trying to settle on a naming standard, but I keep changing my mind - oof).

The ultimate solution for me would be an option to keep reference designator position and orientation if the reference designator name is unchanged.