Generating G-code with Common Lisp

gcode

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.

You may remember Ruin & Wesen from when they shared their Eagle layout videos.

[Thanks fbz]

Comments

  1. j-striker says:

    I learned about the G-Code on the STREETS, fool.

  2. Wolf says:

    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.

  3. Gryphin says:

    as long as you have some stop/home limit switches on the machine, you have no chance of runaway g-code damaging the machine.

  4. jproach says:

    @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.

    http://en.wikipedia.org/wiki/Computer-aided_manufacturing

  5. Any self replicating machine should know g-code, and yes, it should learn it on the streets. Or in a lab. I don’t really care. So long as someone else does it.

  6. chris says:

    Occasionally I’ll use unigraphics to generate my g-code, but often I get pissed at it and write my own c++ to generate my tool paths. I totally understand where these guys are coming from.

    if you know exactly what you want the tool to do, generating your own g-code isn’t a terrible idea.

  7. wesen says:

    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 :)

  8. Nectarpuke says:

    I know very little programming, so compiling my own generator has been thus far out of the question. I run Cincinnati lasers for a living and always find myself writing my own code line by line.

  9. Knoworange. says:

    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 !
    :)

  10. thanks for this info taken ages to find this.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 97,706 other followers