Hugonweb | CNC G-Code

From the Tormach website and LinuxCNC G-code quick reference

Modal Groups

Motion Mode

G-Code Description
G00 Rapid positioning
G01 Linear interpolation
G02 Clockwise circular interpolation
G03 Counter-clockwise circular interpolation
G33 Spindle synchronous motion
G38.x Probe toward target (not supported by Tormach?)
G73 Peck drilling cycle
G76 Lathe multi-pass threading cycle
G80 Cancel motion / cancel canned cycle
G81 Drill cycle
G82 Drill cycle with dwell
G84 Peck drill cycle
G85 Boring cycle, no dwell, feed out
G86 Boring cycle, spindle stop, rapid out
G88 Boring cycle, spindle stop, manual out
G89 Boring cycle, dwell, feed out

Plane Select Mode

G-Code Description
G17 XY-plane
G18 XZ-plane
G19 YZ-plane

Necessary for circular interpolation and canned cycles.

Linear Distance Mode

G-Code Description
G90 Absolute distance
G91 Incremental distance

Arc Distance Mode

G-Code Description
G90.1 Absolute distance: Two of I, J, and K are required and absolute
G91.1 (default) Incremental distance: I, J, and K are incremental, so missing means 0

These are for circular interpolation, where I, J, and/or K describe the center of the circular arc in X, Y, and Z, respectively.

Feed Rate Mode

G-Code Description
G93 Inverse: Feed in minutes / distance
G94 Normal: Feed in distance / minute
G95 Distance / revolution (not for threading)

Distance Units Mode

G-Code Description
G20 Inches
G21 Millimeters

Cutter Radius Compensation Mode

G-Code Description
G40 Disable cutter radius compensation
G41 Left cutter radius compensation (based on tool table)
G42 Right cutter radius compensation (based on tool table)
G41.1 Left cutter radius compensation (based on diameter argument)
G42.1 Right cutter radius compensation (based on diameter argument)

Tool Length Offset Mode

G-Code Description
G43 Apply tool length offset (from tool table)
G43.1 Apply tool length offset (from Z argument)
G49 Disable tool length compensation

Canned Cycle Return Mode

G-Code Description
G98 Retract to original Z position, unless the R argument is higher
G99 Retract to the R argument

Work Offset Coordinate System Mode

G-Code Description
G54 Work Offset 1
G55 Work Offset 2
G56 Work Offset 3
G57 Work Offset 4
G58 Work Offset 5
G59 Work Offset 6
G59.1 Work Offset 7
G59.2 Work Offset 8
G59.3 Work Offset 9

Work Offsets can only be changed while cutter radius compensation is off (run G40 first)

Path Control Mode

G-Code Description
G61 Exact path mode: slows or stops to reach every programmed point
G61.1 Exact stop mode: stops at the end of every programmed segment
G64 (default) Blended mode: tries to maintain feed-rate while coming close to every point

Spindle Speed Mode

G-Code Description
G96 Constant surface speed (in meters/min or feet/min)
G97 (default) RPM Mode

Lathe Diameter Mode

G-Code Description
G07 Lathe Diameter Mode (the only option on Tormach)
G08 Lathe Radius Mode

Stopping

M-Code Description
M00 Stop (pause) program, ignore optional stop setting
M01 Stop (pause) program, if optional stop is on
M02 End program, and stay at current program line
M30 End program, go to program start

Spindle

M-Code Description
M03 Start spindle clockwise
M04 Start spindle counter-clockwise
M05 Stop spindle

Override

M-Code Description
M48 Enable speed and feed override
M49 Disable speed and feed override

Non-modal G and M-codes

G/M-Code Description
G04 Dwell
G10 Tool table and work offset selections
G28 Go to machine position set with G28.1
G28.1 Set machine position to go to in G28
G30 Same as G28
G30.1 Same as G28.1
G53 Absolute coordinates; overrides G91 for this line
M06 Tool change