Replicating pcbnew new for arrayed sheets

Many circuit designs can have repeated structures. Sadly, pcbnew doesn’t have any features to make the placement and routing any more productive.

Here is a demo of a script I wrote to help:

If you have X copies of the same sheet in eeschema, the script will allow you to place and route one of them and them apply that to the other sheets.

How’s it work?

If you call GetPath() on the modules in your design, you’ll get values like these (note the the path is only the /number/number part):

mod Q1 path /587DA765/58758821
mod Q2 path /5875D13C/58758821
mod Q3 path /5875D13D/58758821
mod Q4 path /5875D13E/58758821
mod R1 path /587DA765/5875882F
mod R2 path /587DA765/5875883D
mod R3 path /5875D13C/5875882F
mod R4 path /5875D13C/5875883D

The first number tells you which sheet instance the module belongs to. The second is an identifier for the module. So from the information above we can tell that these are all in the same sheet:

mod Q1 path /587DA765/58758821
mod R1 path /587DA765/5875882F
mod R2 path /587DA765/5875883D

Similarly, we know that these are the same transistor, just in different instances of the sheet:

mod Q1 path /587DA765/58758821
mod Q2 path /5875D13C/58758821
mod Q3 path /5875D13D/58758821
mod Q4 path /5875D13E/58758821

So if I have placed and routed sheet 587DA765, the script just needs to find all of the members of 5875D13C and simply adjust their positions by some constant increment.

The script can be found here in my github repository for kicad

5 thoughts on “Replicating pcbnew new for arrayed sheets”

  1. I am trying to get the script on github to work and it seems to stop after it prints the index of my part. Do you know if there are any limitations to the script? Two things that might be causing this issue is that I am using several multipart components as well as nested sub sheets.

    1. Hi Stephen,
      Thank you for your comment.
      I haven’t tried nested sheets, though I sort of thought about how to approach them when I wrote this. I believe (and I’m not sure on this) that my script should just look at the top level.

      If you are willing to send me a testcase, I’d be happy to look at it. This type of functionality seems to have a demand in the kicad community and would surely be worth the effort.

  2. Hi script fails with this:

    Traceback (most recent call last):
    File “”, line 1, in
    File “/home/heyyo/”, line 142, in
    File “/home/heyyo/”, line 88, in RegisterModulesAndNets
    common = SheetInstance.NetIsSheetInternal(net)
    File “/home/heyyo/”, line 63, in NetIsSheetInternal
    for pad in net.Pads():
    File “/usr/lib/python2.7/dist-packages/”, line 14991, in
    __getattr__ = lambda self, name: _swig_getattr(self, NETINFO_ITEM, name)
    File “/usr/lib/python2.7/dist-packages/”, line 74, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
    File “/usr/lib/python2.7/dist-packages/”, line 69, in _swig_getattr_nondynamic
    return object.__getattr__(self, name)
    AttributeError: type object ‘object’ has no attribute ‘__getattr__’

    I think net.Pads() function is removed.

Leave a Reply

Your email address will not be published. Required fields are marked *