Replicate layout: Action plugin


Here is my first contribution to the Kicad.

It is a Replicate layout action plugin, which replicates arrayed sheets.

I tried running @mmccoo script , but could not get it working as pcbnew python API changed since then. So I rolled my own version, which is more procedurally oriented, as my coding skills are mainly in C. It can be used as an Action plugin or standalone. It also includes some basic testing in case the API changes again.

Any comments are welcome but bear in mind that my response time might be long.

Easy way to lay out a repeated circuit?
Circular Layout in KiCad

Very nice. I’ve been using @mmccoo’s script manually for a while, so I’m looking forward to trying yours. From basic testing, there are two things that I’d love to see you implement:

  1. x-offset and y-offset would be nice to have in the same form

  2. Updating cloned layouts.

The second is the big one, I know. But frequently, one needs to tweak the layout of your master and propagate to the rest of the board. While you can always select/delete/reclone, this is tedious and you often need to work around non-cloned components. I’d suggest that you can use the timestamp to determine which components are cloned. Maybe pick a “magic date” number that the clones can use? Or, set clones to the tstamp of the master?

That said, thanks for sharing a really useful tool!


@Seth_h thanks for the input.

  1. GUI has been changed
  2. I’ve added an option to remove tracks and zones. But it will remove all tracks and zones which are contained/intersecting bounding box where the replicated modules are before replication and where they will be after replication. This was a quick fix. In order to remove only tracks/zones which have been placed by the plugin a robust system would need to be thought out (your ideas certainly point in right direction).


Nice @MitjaN. My last board I replicate manually. This goes against some requested features:
And some high level features of some commercial EDA.

My tips of option:
Replicated [yes/no] the filled zones (or even some checkbox for individual elements categories).
To offset, maybe if more useful been fill by default as the boundary of the layout routed, or other some way to avoid no intensional over placement of the replicated layout (there is a method GetSize or GetBoundary in the pcbnew).

I was trying to do it but getting the already routed hie layout from a other file (sometimes we create different projects and append the layouts). I think this is a good feature do add to your code.

I will check and GitHub and see if I can propose something.


Thanks for the input. New version is available with checkboxes for zones and tracks


New version of plugin is available. It now supports linear and circular replication.


Hi @MitjaN, found this and was trying to start using it. New to the entire KiCad thing, however i’m running into a couple of problems with the scripts. I was hoping you might be able to detail what is going on. Might be i’m not setting the script up in the correct folder or i’m using the wrong KiCad version.

  • Issue 1. When running the script, I get an error message saying ‘More or less than 1 module selected. Please select exactly one module and run the script again’. This happens before you GUI window pops up. This goes away if I select a single component from my hierarchical sheet, however that sort of defeats the purpose.

  • Issue 2. If I select a single component to run, I get a python action plugin code error that complains about your files that ultimately leads to a ‘track_bb’ referenced before assignment.

I’m running Windows 10 with KiCad Version 5.0.0-rc2-dev-659-g1f5b575ea.



Issue 1: This is how I implemented the plugin. When one module is selected, the plugin looks up on which subsheet it is located, and then selects all modules from the subsheet for replication. The plugin currently supports only replicating whole subsheet, and with complex layouts (not in a sqare box) it would be a pain to select all the modules. Furthermore selecing tracks and zones would be even more difficult. It would be a nice feature though.

Issue 2: Even though that Kicad is under heavy development and the action plugin has been tested with an older version it is more likely that you’ve discovered a bug in the plugin. Could you paste a screenshot of the error message? Could you send me a .kicad_pcb file (via PM) so that I can recreate the issue and hopefully fix the bug?


Hi MitjaN. I understand this better now, especially seen as how it is now working in my design. Coming from a Altium Designer background I understand the mistake I was making with respect to selection all of the components (modules) in a sheet and then trying to replicate. I sadly am unable to now reproduce the issue with the python action plugin code error, not sure why that is. If it happens again I will make sure to copy and post. I believe the problem stemmed from selecting discrete components (resistor/capacitor) rather than active components, as my design has a rather larger number of discretes on each page.


Found the bug and fixed it. Thanks for reporting