Cynbe's PCB Milling Gerber to G-code converter

Cynbe ru Taren

This project has moved to sourceforge!

Patrick Birnzain has kindly set up a sourceforge project for this program under the new name pcb2gcode. That version contains some nice improvements by Andrew Jessop. The version here is of mainly historical interest, although some people tell me it is the only version that runs reliably.
-- Cynbe 2009-06-20.

Summary: This page contains the Linux source tarball for a simple Gerber to g-code converter suitable for converting output from the Unix 'pcb' program into CNC (computer numberical control) "g-code" files for hobby CNC mills. I wrote this program to fill a practical need; I share it under the "release early, release often" philosophy: it does what I need at the moment, your milage may vary.

Background: It is hard to do anything practical in electronics these days without making up PCBs (printed circuit boards). Having prototype PCBs made commercially is both slow and expensive; it is convenient to make these at home. One popular method is PCB milling -- some pictures, videos and forums may be found here.

In the open source world, PCB milling may be done by creating the board schematic via the gEDA electronic design automation suite, laying out the board physically using the pcb program, and finally milling out the PCB using a tabletop CNC mill such as those produced by Sherline, under control of EMC2, the open source community rewrite of the NIST-contributed EMC program for controlling CNC machine (and also robots and such).

The problem: Unfortunately, Matthew Sager's excellent and admirable gerber_to_gcode program for converting pcb-produced Gerber RS-274-X files to CNC-friendly RS-274-NGC "g-code" files, was not yet stable enough to do what I wanted. As the sourceforge site notes, it is currently "in the early development stages". (GCAM provides an alternate, GUI-based, approach.)

The solution: I took a week to thoroughly rewrite Matthew's excellent program to do what I want, and that is what I post here:


Discussion: The major differences between my rewritten version and Matthew's version are:

I've also done a fair amount of debugging, simplifying, clarifying, commenting, formatting, and have implemented I think most of the things on Matthew's codebase to-do list.

I believe the code is ready for initial beta-testing use. I haven't actually run the produced g-code on a mill yet (I'm still getting mine set up) but it looks reasonable, and the code is simple enough that any teething bugs should be easy to fix.

Feel free to email comments and suggestions to cynbe at cynbe dot us. I no longer read email daily or even weekly since the spammer crowd turned my inbox into a sewer, but rest assured I'll get around to reading your mail eventually, and will be properly appreciative when I do.

Life is Good!

-- Cynbe

Last modified: Wed Jan 4 14:41:00 CST 2012