Tutorials on python scripting in pcbnew

I have a new post on my kicad scripting blog. This one showcases some of the things you can do in scripting (If I were god, most of the editing functionality of pcbnew… most tools actually, would be writting in scripting languages. It would be much easier for folks to customize)

https://kicad.mmccoo.com/2018/01/30/scripting-fusion-360-designs-into-kicad/

I’ve made a youtube showing all of the steps I used to generate this board:

which I drew mostly in fusion 360:

Here’s the video:
https://youtu.be/av5HwAFl2VI

The post and the video don’t explain much about how the scripts work, but I do want to recommend a couple existing python libraries out there:

When playing around with the libraries below, remember that while they may return some cryptic data structure, you can often wrap that structure into a list(blah) call. Those structures are often/usually just a list and passing it to the list function gives you the kinds of lists you’ll fine more familiar.

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… Designing layout is mostly geometric, so this is a nice tool to have in your pocket.

The dxf_grabber library is how I parse dxf files. Together with shapely, you can do a lot of import stuff.