A KiCad script to programmatically create simple labels

KiCad is a great tool and one of its features I like more is scripting. Here I want to share a very simple script that helps in generating labels using KiCad, pcbnew in particular.

The idea is very simple:

  1. A “reference” label is created on the first copper layer, with known placeholders inside text labels;
  2. The python script is modified by inserting the correct placeholders and the text strings we want on the labels;
  3. The python script is executed, which replicates the labels on the other copper layers;
  4. The generated layers are printed and after some cutter work, the labels are ready.

The kicad-ized python script and the example pcbnew project can be downloaded from here (it would not deserve a git repo, but wordpress does not allow uploading zip files…). I used this script to generate some labels to organize the resistors obtaining this:


Of course, to generate different labels both the python script and the pcbnew file must be modified, but it’s very trivial.

Happy printing,
Cheers 🙂