CHIPBY KINETIC CARVING
CNC · Hobbyist · Information · Platform
Return to Kinetic Carving
General · Files and databeginner~3 min read

G-code and post processors in plain English

Short answer

G-code is a text list of movements. G0 is a fast move with no cutting, G1 is a cutting move at a feed rate, and X, Y and Z are the destination. The post processor is a translator that writes those lines in the exact dialect your controller expects.

Reading a line

A typical line looks like this:

G1 X2.500 Y1.750 Z-0.125 F60

Move in a straight line, cutting, to the point 2.5 in X, 1.75 in Y, 0.125 below zero in Z, at 60 units per minute.

That is the whole idea. A program is a few thousand of those, plus some setup at the top and a tidy shutdown at the bottom.

The commands you will actually see

CodeMeansNotes
G0Rapid moveMaximum speed, not cutting. Happens at safe Z, above the work. A G0 at a cutting depth is a red flag.
G1Linear cutting moveStraight line at the programmed feed rate
G2 / G3Arc, clockwise / counter-clockwiseSmoother and smaller than thousands of tiny G1 segments
G20 / G21Units: inches / millimetresNear the top of the file. Getting this wrong scales your job by 25.4
G90 / G91Absolute / relative positioningAlmost everything is G90, absolute
G54Work coordinate system 1The offset from machine home to your work zero
M3 / M5Spindle on / offWith S for speed, as in M3 S18000
M6Tool changeBehaviour varies hugely between controllers
FFeed rateUnits per minute, in whatever units G20 or G21 set

Why post processors exist

Controllers do not all speak the same dialect. One expects a tool change to pause and wait for a button. Another wants the spindle command written differently, or does not support arcs in a certain plane, or needs the file to end with a specific sequence. The CAM software knows the geometry; the post processor knows your machine's quirks.

This is why choosing the wrong post processor is a real and common problem. The toolpaths are right, the geometry is right, and the machine still does something strange: it ignores tool changes, it runs in millimetres when you meant inches, or it plunges at rapid speed. Almost always the answer is the post processor, not the design.

Match the post to the controller, not to the brand
Machines from the same manufacturer can ship with different controllers across model years. Pick the post that matches what is actually running your machine. See controllers and ecosystems.

Previewing before you cut

Every serious CAM package has a simulation, and there are free G-code viewers that will draw the toolpath for you. Use them. Two minutes of looking at a preview catches:

  • A rapid move that crosses the work at the wrong height
  • A cut that goes deeper than your material
  • A toolpath that runs past the edge of your stock
  • Toolpaths in the wrong order, for example a profile cut before the pocket that needed the material held down

Editing G-code by hand

Occasionally useful, mostly avoidable. Reasonable edits: changing a feed rate, removing a tool change, adding a pause. Unreasonable edits: trying to fix geometry. If the shape is wrong, fix it in CAD and re-post. Hand editing a few thousand coordinate lines is how you get a cut that is right for 90 percent of its length.

Restarting a failed job
If a job fails part way, the G-code is a text file and you can find the line where it stopped. Restarting from there requires care, because the spindle and coordinate setup lines live at the top of the file and must be reinstated. Many controllers have a run-from-line feature that handles this properly. Use that rather than deleting lines by hand.