How to repeat multiple layout blocks?


I have simple circuits (FPGA & DDR) place and routed. Is there a way to repeat multiple copies of it on the board ? instead of re-doing routing and placement for every iterations.


Alas, no. At least not yet. You can search the forum for “duplicate layout”. Check especially Replicate layout: Action plugin. See also

Also, if you are using 4.0.7 this script should help too:
pcbnew/ is one of the script in Back import custom fields.

I developed it for layout 10 channel analogs (using schematic hierarchy to share same schematic files which make use 10 channels).

Recently I’ve been experimenting a bit.
The Idea was to draw a massive amount of the same traces to connect an array of RAM / Eprom chips in the fashion this was done 30 years ago.

In KiCad V5.0.2 you can easily copy a trace to an empty board area, then create an array of those traces and then move the whole array. After a bit of practice you can do this quite fast and easily. (This works best on a grid)
In the old way (KiCad V4) a trace belonged to a particular net, and changing it to another net was difficult / gruesome / time consuming.

In KiCad V5.0.2 if you have some copper traces and you move / copy them and the connect to pads from another net then the copper traces automatically get connected to that net, provided of course that the design rules are met and the copper traces are not connected to pads of different nets at the same time.

This may help shorten my clone code :slight_smile: when I have a change to get back to it for 5.x version. I think it should work with just some small modify due to the python interface changed.

I just posted a quite long mini tutorial on manually replicating layout features.
I thought it deserves it’s own thread, and moved the text and screendumps to:

1 Like

I think I would just do normal layout for this type of project. Unless it got much more complex “per” channels like 100+ par per channel or too many channels (when is worth to spend time for figuring out the common trace pattern across channel will be less than ~20% of time for manual route everything). Then I would do the clone/replicate scripts.

A common reason for replicating some layout is when there are multiple connectors on a board, and each connector has an identical circuit behind it.

Using the array function to place the connectors at equal dictance is a logical step.
But if you do a part of the (common circuit) of the board layout beforehand, then you can copy that part with it in the same action. Figruering out how the scripts work is probably not worth it for occasional use, but the copy & paste array stuff I played with 2 days ago (See previous post) is very straightforward and simple to use that it probably will save some time.

Did you see my example board in the “Replicate layout: Action plugin” thread linked above? That was done approximately in the way you describe, except that the repeated subcircuit is a hierachical sheet (which I recommend). Unfortunately the script by @MitjaN didn’t have all the required features back then. I will try the newer version of that script when I next time has similar need. Doing this thing manually is so and so bearable, but when you have to make modifications to the design it becomes extremely tedious. I just can’t recommend doing it manually if it can be avoided, not even with array and copypaste techniques.

In your tutorial you write:

This reveals that you didn’t read the mentioned thread. The script knows hierarchical sheets and knows which parts to duplicate. Traces etc. are also handled. In the thread I described how it could work a bit more intelligently and MitjaN implemented it.

You are right that

For simple needs your tutorial is good. But when you copy the tenth modification to ten subcircuits you will pray for a script. Otherwise, pray beforehand for getting it right the first time.

1 Like

Guilty as accused.
I tried to remedy that and had another look at the thread mentioned.
I have never used an “action plugin” / script before in KiCad, so I thought to give it a try, and maybe even make a similar tutorial, so I started reading to learn something new and to see what was aldready done before me.

Followed the link to the Action plugins on github and did a bit of reading there to.
I’m running V5.0.2 Debian/Buster here and KICAD_SCRIPTING_WXPYTHON is disabled so that is already a dead end for me.

Still I did not give up, and did a bit more reading on: file:///usr/share/doc/kicad/help/en/pcbnew.html#action_menu

I did not see an explanation on how to install scripts for KiCad in either of those 3 locations and that is when I gave up.

I also have a tendency to build circuits on a breadboard and test them thoroughly before making 10 copies, to avoid having to make 10 iterations of those 10 copies :slight_smile:

You have good points about script support. Not all Linux distros have packages where wxPython GUI for scripts is enabled. That’s of course a bad thing. Hopefully it will be better in the future.

Likewise the documentation isn’t the best possible. But what we actually need is a GUI for easily installing scripts and other content for KiCad. There were at least two initiatives for that, one of them was mine, but I found it a little bit too much for be considering my resources. I don’t know what’s the state of the project of @bobc.

It’s about mechanical layout for me, not about functionality or changed schematic. But actually I don’t decide those things and my boss has a tendency of changing not only physical dimension but also functional features mid-project, so schematic changes may happen, too. With complicated designs one reason may be that you just need to pack components tighter when you notice you need more room. There may be other reasons, too. Different people have different needs.

If you still use 4.0.7, my script is not GUI, it is console interactive, and it can be run from python console in pcbnew. No install needed. I plan to have it work wit 5.x but not sure when I can have time. I hope some one take a look at contribute, but seem be not easy by just throw the code out on the net :slight_smile:

I trust your scripts will accommodate Linux Mint.

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