This blog is about scripting in kicad/pcbnew. This post tries to showcase some of the things that you can do with python scripts in pcbnew.
The layout of this board was designed in fusion 360 and brought into kicad via scripting. Very little manual work was required in pcbnew; it amounted mostly to deleting stuff and changing some zone names. The scripts also did the routing and placed the many vias
The code I demonstrate can be found on my git hub here and here.
This board implements a ring light for photography (I use multiple boards to stay within the 10×10 limit of cheap fabricators:
I’ve created a video show all of the steps in kicad:
I won’t explain the code in this post, I’ll do that in future posts. I will, however, take a moment to recommend some useful python libraries:
The SciPy library is fantastic for graph algorithms like minimum spanning tree and delanay triangulation
The shapely library is very nice for polygon manipulation. Merging polygons, bloating and shrinking them…
The dxf_grabber library is how I parse dxf files. Together with shapely, you can do a lot of import stuff. 1
Hope it helps
sadly, I had already implemented a bunch of code merging lines and arcs into polygons.↩