ScriptedPCB
Scripting PCB design with Python, via pcbnew or KiCad's IPC API
Tutorials for automating KiCad with Python: footprints, traces, vias, copper zones, DRC, and fabrication export — with pcbnew and KiCad 10/11's IPC API.
Available tutorials
Footprints(4)
Duplicating an existing footprint with pcbnew's Python API
Clone an already-placed footprint instead of recreating one from scratch, to quickly reproduce a component with its properties — with pcbnew or KiCad's IPC API.
Flipping a footprint to the back layer with pcbnew's Python API
Move a footprint from the front to the back layer of the PCB by script, for a component mounted on B.Cu — with pcbnew or KiCad's IPC API.
Placing a grid of footprints with pcbnew's Python API
Position several identical footprints in a grid by script — useful for an LED panel or a row of connectors — with pcbnew or KiCad's IPC API.
Positioning a footprint with pcbnew's Python API
Learn how to position and rotate a footprint on a PCB by scripting pcbnew's Python API directly, without going through the GUI.
Traces & routing(3)
Adding a layer-change via in the middle of a route with pcbnew's Python API
Move a trace from the front to the back layer through a via placed mid-route, by script — with pcbnew or KiCad's IPC API.
Routing a right-angle bent trace with pcbnew's Python API
Create a trace with a right-angle bend between two unaligned points, by script — with pcbnew or KiCad's IPC API.
Routing a trace with pcbnew's Python API
Create a copper trace between two points, with a defined width, by script — with pcbnew or KiCad's IPC API.
Vias(4)
Auditing and counting a board's vias with pcbnew's Python API
List and count a board's existing vias by net, to spot an excess of vias or check a fabrication constraint — with pcbnew or KiCad's IPC API.
Creating a blind or buried via with pcbnew's Python API
Turn a regular through via into a blind or buried via, restricted to certain inner layers, by script — with pcbnew or KiCad's IPC API.
Creating a stitching-via grid with pcbnew's Python API
Generate a full grid of ground-connected stitching vias by script, instead of one via at a time — with pcbnew or KiCad's IPC API.
Creating a via with pcbnew's Python API
Add, position, and size a through-hole via on a PCB by scripting it, with pcbnew or KiCad's IPC API.
Copper zones(4)
Creating a multi-layer copper zone with pcbnew's Python API
Apply the same copper zone to several layers at once with an LSET, instead of duplicating the zone layer by layer — with pcbnew or KiCad's IPC API.
Setting a copper zone's thermal relief with pcbnew's Python API
Configure the thermal relief around pads connected to a copper zone, by script — with pcbnew or KiCad's IPC API.
Creating a routing keepout zone with pcbnew's Python API
Reserve a region where no track, via, or copper fill can be placed, by script — useful around a mechanical connector or an antenna — with pcbnew or KiCad's IPC API.
Creating a copper zone (ground plane) with pcbnew's Python API
Generate a copper zone connected to a net and trigger its fill by script, with pcbnew or KiCad's IPC API.