When I google for kicad and panelize, a top link is this one which talks about this panelizer written by Stijn Kuipers. The instructions given there are almost enough for me
I had two difficulties with the panelizer, but once I got beyond those, the process is quite easy. The troubles for me where:

  • I’m a linux guy. The released version doesn’t run under mono. There’s a side version that works well
  • I’m a kicad guy and the hackaday tutorial, while mentioning kicad, seems targeted at Eagle people. This is also easy to deal with if you know a couple key pieces of information.

Edit Dec 29, 2017: I’ve added a section simple panelizing directly in Kicad. Also, I added a comment on pcbshopper in the rant

Running on linux

When I run the released panelizer via the latest mono I could find for linux, I ran into the issue reported here, ie I get a message that contains this:

System.ArgumentException: XOR data length expected 

There’s a bunch of discussion in the issue, but the short answer is to use a compile that runesoeknudsen attached to the ticket. The compiled working version can be downloaded here. It hasn’t given me any trouble on ubuntu 16.04 and, but I’m guessing any mono will be fine.

Kicad related issues

The other issue I had was that the tutorial was written from the perspective of a non-kicad user. There are a couple things you have to watch for:

  • the panelizer is looking for a particular file extension for drilled holes
  • the panelizer is looking for a particular file extension for the board outline
  • and it is looking for particular file extensions for the layer files.

Notice any common themes? It’s trivial, actually, but… most things aren’t hard… if you know how to do them. 1.

Drill file

Generate the drill file as normal. Just rename it to .txt. If you don’t do this, you’ll get a merged drl file and a merged txt file. the drl file will contain your original holes, properly translated to the panelized positions. The txt file will contain the holes needed for the break away tabs.

Board outline

This a simple matter of renaming the gm1 file to gko.

The layer files

You have to use the kicad plot option “Use Protel filename extensions”. Kicad gives a help message “this is no longer recommended”, which misled me for a bit. In this case, I recommend it.

Simple panelizing directly in Kicad

If you start pcbnew directly, 2 you’ll get the “append board” command in the file menu. So starting with a new board, append each design you want.
Note that nets with the same net will get merged, so if you delete GND, all of ground will be deleted. You may also get opens reported.
You might find my gen_border script useful3, which will shrink a rectangular boarder around your design. It’ll also add a power and/or gnd zone on the same boundary.

A rant

The rest of this post adds nothing about how to panelize. Instead I want to rant a little.
There are a bunch of services out there that offer cheap pcb fabrication for 10cmx10cm 2 layer boards. If you submit a set of gerbers that looks like multiple designs, they won’t make it for you. They want more money.
I recently did two small LED boards. They’re pretty small, so I put two of one and one of the other in a design and sent it off. denied.
My design has very few holes. The outline is not that complex, even with the added tabs. What’s the problem? I’m paying for 10×10 and 2 layers. I’m not ask for anything beyond that.
What’s the cheapest service that won’t hassle you for including multiple designs on one board? I am aware of pcbshopper.com. The problem is that even if you enter something other than 1 in the multiple designs field, the returned links won’t allow multiple designs. Also, dirtypcbs and seeed studio are said to be panelize friendly, but with shipping, you might as well buy multiple designs from a cheaper vendor. I think all this is a sign that I’m too cheap. I’m racing to the bottom.

Panelizing Kicad gerbers

  1. my corollary to this is: “nothing is wierd… once you know the explanation for it.

  2. ie, close the kicad project manager and just open pcbnew,

  3. I need to plugin’ify it so it can be run from the “external plugins” menu

11 thoughts on “Panelizing Kicad gerbers

  • December 29, 2017 at 6:06 am

    Thank you! I was trying to do a multi board panel today, tried many tools, got the same error from panelizer. Got some crash, mainly around GUI handling, but was able to do the gerber panel. I’m using Kali (kernel 4.13) with mono 4.6.2. During my search I went into http://projects.borg.ch/electronics/kicad/panelize.html, it’s a python script that merge Kicad .kicad_pcb files. I liked the idea, since it is possible to reload it into kicad and possibly add routing between the boards for testing purpose and also perform DRC on the whole panel. But it doesn’t support new .kicad_pcb files, in fact the script do all the parsing of the pcb file by itself, I began to adapt it but went into “fppoly” which is more complex to process. Then I remembered your work with pcbnew’s python and that all the file processing is already done with the new versions of pcbnew. Then I went to your post regarding panelizer, tried it, and did what I wanted to do for the whole day…
    > What’s the cheapest service that won’t hassle you for including multiple designs on one board?
    https://dirtypcbs.com/store/pcbs/about is supporting panelizing, quality is supposed not as good as OSH park but quite good, it’s my first try. There is also https://pcbshopper.com/ that do pcb manufacturer comparison.
    However merging kicad pcb file might be great. Does it looks hard, to you, using the pcbnew python libs? With what you know about it.
    Thanks again!

    • December 29, 2017 at 2:17 pm

      i’m glad it was helpful. I’ve added a section to this post talking about how to panelize directly in pcbnew. I think the “append board” command in pcbnew is what you’re looking for. no scripting required.

      • February 26, 2018 at 2:48 pm

        > I think the “append board” command in pcbnew is what you’re looking for. no scripting required.
        I’m designing boards for eurorack synth modules that are typically 10*2cm so would want to squeeze in 4-5 of them into one of those 10*10cm panels. I really DO want scripting though as I iterate the designs a lot. I’ve been using that same python script that works on the source files, but found it rather limiting with the input file format being static.
        However, I’m now considering using your stuff as a source of info how to script. I however want to script from outside of pcbnew command line to iterate faster. Does the append board command have a version in the python api?

        • February 26, 2018 at 5:13 pm

          synth modules. that’s a road I’ve decided to travel recently. Do you have any designs you’d care to share? Maximizing 10x10cm is what I was thinking about as well.
          I think you want something like below. The key to making that work is to have consistent board origins. Generating your boundaries like I did herehere could help.
          I’ll probably do a post summarizing all this.
          import sys, os
          # Add the home directory to sys.path
          import pcbnew
          def append_board(main_board, other_board_file, offset):
          offset = pcbnew.wxPoint(pcbnew.Millimeter2iu(offset[0]), pcbnew.Millimeter2iu(offset[1]))
          other_board = pcbnew.LoadBoard(other_board_file)
          for mod in list(other_board.GetModules()):
          for net in list(other_board.GetNetsByName().values()):
          for track in list(other_board.GetTracks()):
          for zone in list(other_board.Zones()):
          #main_board = pcbnew.GetBoard()
          print(“loading main”)
          main_board = pcbnew.LoadBoard(“/home/mmccoo/empty.kicad_pcb”)
          print(“loading other”)
          other_board = “/bubba/electronicsDS/kicad/leddriver2/leddriver2.kicad_pcb”
          append_board(main_board, other_board, (0,0))
          append_board(main_board, other_board, (0,50))
          append_board(main_board, other_board, (0,150))
          pcbnew.SaveBoard(“/home/mmccoo/collage.kicad_pcb”, main_board)

          • February 27, 2018 at 1:29 pm

            Awesome, thanks alot!
            I’m going to try this path. I was about to start building my own parser of the s-exp files in Purescript with combinator parsers and also checked out this project here https://github.com/cho45/kicad-utils, but seems like taking the path of using the official api is much more sensible. Even though I’m not a Python guy 🙂
            About eurorack:
            Currently I’m mostly doing other’s designs and a few in development. But check out https://gmsn.co.uk/ for instance which is open source boards for eurorack. The Eagle import in Kicad 5 was working well enough for me to be able to do small mods for using the components in store.

          • February 27, 2018 at 2:00 pm

            >for net in list(other_board.GetNetsByName().values()):
            Would it be easy to prefix the net names with some board index just like that panelize.py script does so that DRC and stuff would still work?

  • February 27, 2018 at 1:51 pm

    About the panelization rant – I totally agree, it feels so arbitrary and I don’t like to feel i would want to almost obfuscate my designs as to not show they are 4-5 different pcbs. Just plain irritating.
    However, seedstudio actually wrote this:
    “If you don’t want to pay extra money for the panelize fee. You can make the outline like this and cut the board by yourself.”
    Since my panels are going to be pretty basic with straight cuts through the whole board I’m going to give it a shot. I got this old Swedish made monster paper cutter that cuts through 1.6mm glass fiber like it was cheese, https://photos.app.goo.gl/RoyQJJ0exxLmijpk1. I’m going to hand solder them anyways.

    • March 2, 2018 at 8:05 pm

      Nice cutter. Similarly, I’ve found that a dremel with a cutoff wheel works well. My outlines are all straight as well.

  • March 17, 2018 at 10:03 am

    Hi again Miles!
    I’ve been basing my scripts to panelize successfully on the info here. Thanks a lot!
    Before I was using this panelize.py (http://projects.borg.ch/electronics/kicad/panelize.html) that did it differently with its own parser and no dependency on kicad itself. This approach here seems better to me, mostly because of extensibility. However, I just now realized I don’t fully know how to rotate or flip. Rotate being the most important feature right now. Sometimes I’m designing boards horizontally but really want to rotate 90 degrees when doing the panel. Do you have any tips on how to approach that with the api? Does the api have anything supporting this or do I have to do the math myself?
    I’ve been trying to look into the code that does this with panelize.py, but man I have troubles reading Python files with thousands of loc.

  • October 9, 2018 at 1:54 pm

    I managed to hack up panelize.py so it works with KiCad 5 to a limited extent (use only polygon fills and no edge options). I used it to panelize an oddly shaped board, however the second and third copy added a few traces and bits replicated off to the side, nothing I can’t fix, however.

  • April 13, 2019 at 12:16 pm

    I’m trying come up with a script that will import a series of (all different, but only top, bottom, Edge cuts and drill layers) PCB’s and append them to an EMPTY board that I can use for panellizing. I need to be able to specify where the imported file will be placed the (X and Y co-ordinates). So the script will need to import each file one at a time and then allow me to increment/decrement the co-ordinates and then when it’s in the correct position click OK. This is just a helper script to speed up manual placement of appended boards. Can you give me a nudge in the right direction? I’m using Kicad 5.1 so hoping python is usable in this version. Thanks.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.