Use Nodes To Code Loads Of G-code For 3D CNC Carving

Most CNC workflows start with a 3D model, which is then passed to CAM software to be converted into the G-code language that CNC machines love and understand. G-code, however, is simple enough that rudimentary coding skills are all you need to start writing your very own programmatic CNC tool paths. Any language that can output plain text is fully capable of enabling you to directly control powerful motors and rapidly spinning blades.

[siemenc] shows us how to use Grasshopper – a visual node-based programming system for Rhino 3D – to output G-code that makes some interesting patterns and shapes in wood when fed to a ShopBot. Though the Rhino software is a bit expensive and thus is not too widely available, [siemenc] walks through some background, theory, and procedures that could be useful and inspirational no matter what software or programming language you’re using to create your bespoke G-code.

For links to code and related blog posts, plus more lovely pictures of intricately carved plywood, check out [siemenc]’s personal site as well.

[via Bantam Tools]

9 thoughts on “Use Nodes To Code Loads Of G-code For 3D CNC Carving

    1. SketchUp has Grashopper? News to me!

      I did do some Ruby scripting in SketchUp many moons ago. And my first Rhino “thing” was done using RhinoScript (which is just VBA). Using the API actually helped me to understand Rhino (well enough to do some damage), since the GUI really just generates calls to the API. For me, the scripting provided an on-ramp that made it easier to learn (writing code was 2nd nature .. wrangling rhino with a mouse and keyboard less so).

  1. This reminds me of some youtube tutorials of using python scripts in FreeCAD to generate CNC Toolpath data.

    Did some searching, came up with user sliptonic on youtube.
    FreeCAD Path: Custom paths with Python – Part 1

  2. There are a number of Python scripts here that make G-code for simple tasks:
    https://github.com/linuxcnc/simple-gcode-generators
    (Pocketing, engraving, airfoils for foam cutters, that sort of thing)

    Or there is a C-like language that outputs G-code:
    http://tsemsb.blogspot.com/2010/04/cgcc-gcode-with-c-constructs.html

    Or you can just write G-code by hand, I wrote up a fairly mathematical example here: http://bodgesoc.blogspot.com/2016/11/cams.html

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.