Generating G-code with Common Lisp

Ruin & Wesen are a two person shop creating specialized music gear. As part of their recent MIDI Command development, they got into case manufacturing. They purchased a mini CNC mill to cut the aluminum cases. Unhappy with the software options provide [Wesen] decided to write his own G-code generator. G-code is part of the numerical control used to command CNC machines. He implemented his interpreter using the language he’s most familiar with: Common Lisp (not surprising if you notice the website’s backend). The post covers the design philosophy used and some of the problems that came up. We look forward to future releases since the interpreter can generate milling code using processing.org sketches and cut PCBs directly from Eagle.

10 thoughts on “Generating G-code with Common Lisp”

My roomate and I are in the process of building some speaker boxes with our colleges cnc mill, but as far as I know, solidworks cant export any file types that the mill can use. Does anyone know of a good dxf, dwg g-code, ect generator that can combine multiple parts to be cut out of one sheet, and can handle multiple cut depths? (the speakers are flush mounted)

As for the hack, its interesting, but I’d be worried about damaging my cnc machine with some malformed g-code.

@wolf: the step you are missing between solidworks and g-code is the CAM software. This is where you choose what endmill you will be using, how to cut the paths, how deep, speeds, etc.

I’m sure your college will have some software that will either be integrated into solidworks (solidCAM), or allow importing of a 3D file (step, sldprt, etc.). Importing multiple designs into one cut should not be a problem.

I usually run the simulator in my cnc control software to see what the g-code does. Also I added a security zone feature. You can definitely run into trouble pretty quickly if you’re not careful, but that goes for cam-tool generated g-code as well. Running into clamps, running into sensors, or just breaking tools cause you are not careful or don’t know the material yet. I bought a ton of used bits off ebay to check for things when I first mill new materials, as I had some pretty expensive days in the lab :)

The software can import g-code and panelize it btw, it also recognizes fly over and mill parts, and can optimize them using a slightluy customized version of the traveling salesman algorithm. I’ll write about this soon :)

Thanks so much for this great post!
I found a youtube video about xbox live hacks- that I would like to share- xbox live Hacks!.
but seriously, great post and thank you so much !!
i look forward to your next article !
:)