Import .gbr (Gerber) file

edited April 2014 in File Formats
I don't manage to import Gerber files in KLayout, although the documentation mentions things about "Gerber PCB files". How do I import a single ".gbr" file in KLayout ?
Thank you,


  • edited April 2014

    Hi Olivier,

    Gerber import is not straightforward since Gerber files are not necessarily self-contained entities. You'll need a little background knowledge for that.

    Did you have a look at yet? I hope it's comprehensive.


  • edited 11:57PM

    Thank you for indicating the right direction. I managed to import my Gerber file. The procedure is in fact easy, but I found it daunting at first. Here are my comments about this:

    * The procedure is very professional, but may be a bit too daunting for importing just a single .gbr file. Maybe a menu entry for importing a single Gerber file would be useful for those who do not need the full power of the complete procedure.

    * The name "project" sounds a bit overkill to me... (maybe just to me). At first, I was afraid and I thought "My God, what is it going to do with my Gerber files?"
    I'd prefer to call it an "import recipe" than a "project", because it does not contain actual design data, but only a description of how to import data.

    * In the web page you pointed, there is no mention of the .gbr file extension. This made me doubt and wonder if this was really the right way to go. For example, the screenshot in "The free layer mapping flow" shows files with strange extensions like "bot", "bsk", "bsm",... but no "gbr" ! This is unfortunate that the "gbr" extension is not mentioned because if I'm not wrong, this is the standard extension for Gerber files.
  • edited 11:57PM
    There may be a bug or a limitation in the importer. I have this file structure:


    For successful import, I set the "Base Directory" to "Workdir/Gerber".

    However, when I reload the "import.pcb" import recipe another day, the "Base Directory" is reset to "Workdir" only. I think the "Base Directory" is not saved in the import recipe file. This imposes that the import recipe file be in the same folder as the GBR files. This may be a limitation, and it may be an improvement to save the "Base Directory" in the import recipe file.

  • edited April 2014

    Hi Olivier,

    A Gerber file does not make much sense as a single entity. A "project" describes a PCB board. A board will almost always consist of multiple files - artwork, drill files and maybe others. Hence, to import PCB data to a multilayer flow, it's not sufficient to just take some file and import it somehow. Typically the files do not have a certain extension too. ".gbr" is not a common choice - you'll find every kind of extensions is a typical PCB project. So there is no way to bind the format to a specific extension.

    As the name says, the functionality is to "import" a PCB layout. In order to provide the necessary side information, at little work cannot be avoided. That specifically applies to the mapping of drill files to the usual VLSI interconnect concept. Coated drill holes may connect multiple routing layers while via holes just connect two.

    If you just want to view files, you should look for gerbv which is an excellent alternative. KLayout's function was supplied to connect GDS layouts with PCB data and that is a different scope.

    The base directory feature is intentional - it will always be the location of the import.pcb file. If you want to supply paths relative to he import.pcb file, specify "workdir/filename.gbr" for your individual files. You can also use absolute paths for single files, but that way you won't be able to easily move a PCB project somewhere else or archive it.


  • edited 11:57PM
    Hello Matthias,

    I will answer point to point:

    * Gerber format is not only used for PCB. It is used for any photoplotting work, which includes a great number of possibilities (cheap photomask fabrication, art, whatever). A Gerber file really makes sense on its own. For example, a client may send me just the top copper layer of his PCB (the client has his own reasons to keep the bottom layers secret). So what I will receive is just one Gerber file.

    Believe it or not, in the past years, I had to import single Gerber files quite more often than full PCB stacks. That's my experience. Maybe yours is different. Now if you don't want to add a quick way to import single Gerber files, it's your entire right, because you are the creator of this great software.

    * Concerning the file extension, I've mostly known Gerber files with ".GBR" extension, and quoting Wikipedia: "The standard file extension is .GBR"
    ( This web site also tels the same,

    * Concerning the "base directory", I think your choice of not using it is an arbitrary limitation. Even, if it is just defined as the directory location of the "project.pcb" file, there is no need to mention it because it can be retrieved from the file location.

    Of course, I know it' easier to criticise than to do things :-)
  • edited April 2014

    Maybe I was not explicit enough: if you're seriously looking into Gerber, there is gerbv and many other tools. KLayout is a silicon layout tool and there are multiple layers, a particular idea of connectivity, few round features and not much use for apertures and so on. Gerber support was specifically designed to import of PCB data into the IC world. You're looking at a special functionality here.

    You can still import single files, but that's a special case only. It's possible to automate single Gerber file import somewhat by scripting the generation of an import.pcb file - it's a tiny piece of XML file and KLayout will recognize it as a layout format of it's own. In that sense, import.pcb provides the metadata required.

    Regarding the file extension I definitly disagree - regardless of what Wikipedia says. I got a lot of samples out of different systems. Plus I studied a lot of PCB data available to the public, for example for demo board layouts. Here is a brief selection of extensions: .art, .drl, .gbl, .tx1, .tx2, .tx3, .g1, .g2, .g3, .g4, .gtl, .exc, .bot, .bsk, .bsm, .bsy, .gnd, .vdd, .tsk, .p01, .p02, .p03, .p04, .pcb and even without extension ... there are some .gbr too, but there's not a clear preference.

    And regarding the "base directory" - it's supposed to be used initially. When you start a new project and you set up a base directory, the file names are stored relative to that path. If not, the file names will be stored as absolute paths. If you use a base path and save the .pcb file into the directory (Disclaimer - it's right, it does not go there by default), then the files are in the proper place and can be found relative to the .pcb.


  • Hi Matthias,

    I would like to import Gerber files in batch mode. I found that you mentioned to "import.pcb" file. Could you show how to build this file?


Sign In or Register to comment.