Homebrew, open source, repurposed, hacked, software defined, open hardware

Saturday, 30 April 2016

Importing or converting gerber files into gEDA PCB layouts

Being able to convert gerber files into pcb layouts can be useful for a couple of reasons, namely:

- acquiring exotic footprints
- modifying existing designs
- reverse engineering designs
- snatching previous design efforts from the jaws of obsolescent, closed EDA software products, forced upgrade paths, or cloud based services

Luckily, most of the hard work was done at the turn of the century by Philipp Knirsch, who wrote some gerber parsing code in java that can be used to render gerbers. Philipp licensed his gerber parsing code as GPL2:


The code was modified to play nicely with translate2geda as a conversion option, and now exports gEDA PCB elements in a footprint file.

The footprint file allows new tracks and pads to be snapped to the locations very easily, and since each feature in the footprint file is uniquely numbered, mouse over on the features allows the identifier to be determined, and using the unique identifiers, the element or elements can be copied from the footprint file with a text editor, for example, if a grouping of elements is needed to duplicate a footprint.

I may try to implement layout export with tracks and pads in different layers, but this will be complicated, since some EDA tools paint features such as pads, polygons and tracks, rather than flashing them, making it hard to determine which features are pads vs trackwork.

Only four sided polygons are supported currently, in order to identify rectangular pads which have not been flashed. This may be extended to capture octagonal pads, such as those supported by Eagle and gEDA PCB, and the gEDA PCB fork pcb-rnd.

Ground pour polygons and other complex polygons will not be supported, unless I implement the layout export option, since gEDA footprints do not support arbitrary polygons.

Here's a bottom copper layer gerber viewed in gerbv:

and here's the output from the translate2geda utility being viewed in gEDA PCB

To use the translate2geda utility to convert gerbers like this, you'll need to get yourself on over to github, get the java source and follow the build and use instructions.

I hope to implement Kicad export once the wrinkles have been ironed out and the translate2geda code refactored a bit.

The translate2geda utility will also convert manufacturer agnostic BXL files, Eagle XML libraries, BSDL (.bsd) files, IBIS (.ibs), symdef, LT-Spice and QUCS files into gEDA gschem and gEDA PCB compatible footprint and schematic symbols as well.

The KicadModuleToGEDA and KicadSymbolToGEDA  functionality will be merged into the translate2geda utility in due course, adding Kicad Symbol and Footprint conversion to gEDA gschem and PCB  formats as well.