[CONTINUE] automatic Image/QR-Code integrator

Continuing this thread:

Using KiCad version 5.1.9

I continued working on this, and it is mostly working, but missing one crucial part.

The code:

What works:
When drawing a polygon or zone in rectangular, axis-aligned shape (4 points exactly) ontho the PCB on a slik or copper layer in PCBnew, the script loads that PCB from file, replaces the rectangles with a pre-generated “qr.png” image.The nsaves that to a new *.kicad_pcb file.

What is missing:
A way to specify for each template rectangle, what it should be replaced with. My initial idea was, to use a key-value pair, or if not available, abuse a name or description property to store the path to the image that should be placed there. Sadly, neither DRAWSEGMENT nor ZONE_CONTAINER have any such thing. In python code, it is possible to create a MODULE, give it a name or description, and add polygon or zone into that, but I would not know how to do that in the KiCad GUI.
Do I have ot make a custom GUI plugin that allows the user to do that.
If all else fails, I will somehow have to limit the functionality to a single image which one has to feed directly to my script when invoking it, which would not be so nice.

Any ideas, tips, links to solutions for similar problems (or GUI plugins), maybe?


… alternatively, I could define a hierarchy for the placeholder rectangles, for example:

  1. Copper comes before Silk
  2. Front comes before Back
  3. Top comes before Bottom
  4. Left comes before Right
  5. Drawings before Zones (This one might not survive, as I might kick-out Zones support, as I see no benefit in it)

That way, there would be a unique, clearly defined (although quite arbitrary) order among al the placeholders, and one just has to supply the same amount of images to my script in the same order, for the system to work.
It is not as nice, but… I guess I will do it this way for now, until someone comes up with a better idea.


I would now consider it in beta state -> feel free to try it!


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.