G-code book recommendations

Can anyone recommend a good book for learning G-code? Yes, I’m old and prefer books, but an online tutorial/article would also work. Thanks.

1 Like

there’s… not a LOT to it.
I find that I normally just poke the wikipedia article (https://en.wikipedia.org/wiki/G-code ).
Gcode (as our machines understand it) is just a linear, top down set of commands.

normally there’s some basic one time setup stuff (and at the very end a M02 to end the program) and everything else is a set of G0 and G1 commands that are just XYZ movements.

for learning, I would recommend drawing a single line in Carbide Create, and then do a contour toolpath that just is on that line… save the gcode and open it in notepad (or rather, notepad++ since that’s much nicer)

with that, go through each line and look up what it does in the wikipedia article, and with that… you’ll know 90% of what there is to it ;_)


For Shapeoko (standard GRBL) specific stuff, LinuxCNC, which is the most similar standard, has some great references.


In what context do you want to learn G-Code?

The basics needed for working with Grbl are covered in the references linked, or see:




Note that Grbl lacks loops and variables, so is only suited to code such as a CAM tool will generate (it’s really tedious programming G-Code w/o them) — If you do want to work with G-Code you’ll either want to use LinuxCNC or Mach3, or a pre-processor such as: https://github.com/NRSoft/GSharp

Primarily to understand CAM output, but possibly to program directly in G-code and skip the step of programmatically generated SVG. As well as some details like the multiple coordinate systems.

I’m not sure I’m confident enough to let the output of my limited coding skills drive rapidly spinning metal. (My formal training consists of a single class in Fortran II taken in 1971! G-code does have DO loops, right.)

GRBL doesn’t support loops. (that I’m aware of)

1 Like

Correct. You have to use a pre-processor to instantiate loops from some input format as multiple lines of code.

This topic was automatically closed after 30 days. New replies are no longer allowed.