G commands tell the controller how to move and which mode to calculate in. Most of them are modal: they stay in effect until another command of the same group arrives. If a line only says X10, Grbl keeps using the last motion command. Grbl 1.1 understands exactly the G commands listed here; it rejects others with error 20.
G0 · Rapid move
Moves to the target as fast as possible without cutting. The speed is set by $110 to $112, not by F. The axes start together, but the path is not necessarily straight. That is why good programs first raise Z to a safe height.
Example:
G0 Z5
G0 X0 Y0
G1 · Linear cut
Moves in a straight line at feed rate F to the target. This is the actual cutting motion. A feed rate must be set before the first G1, otherwise Grbl reports error 22.
Example:
G1 Z-1 F200
G1 X50 F800
G2 · Clockwise arc
Cuts an arc clockwise (seen from above) to the target. The centre is given relative to the start with I and J, or the radius with R. I/J is more accurate; a full circle is not possible with R. Grbl splits arcs into short lines internally (accuracy $12).
Example:
G2 X20 Y0 I10 J0 F600
G3 · Counter-clockwise arc
Like G2, but counter-clockwise. A full circle results when target and start are the same and the centre is given with I/J.
Example:
G3 X0 Y0 I10 J0 F600
G4 · Dwell
Waits for the time given with P in seconds before continuing. Typically used after starting the spindle so it can reach its speed.
Example:
M3 S18000
G4 P3
G10 L2 · Set offset directly
Stores the distance of the work zero from the machine position for a coordinate system (P1 = G54 to P6 = G59). The values are kept even after power off.
Example:
G10 L2 P1 X-250 Y-180 Z-40
G10 L20 · Current position as zero
Sets the zero so that the current position gets the given value. This is exactly what the app does for X0, Y0, Z0 and XY zero. The value is stored permanently, unlike G92.
Example:
G10 L20 P1 X0 Y0
G17 · XY plane
Arcs lie in the XY plane, centre with I and J. This is the default and almost always right for cutting from above.
G18 · XZ plane
Arcs lie in the XZ plane, centre with I and K. Rarely needed, for example for roundings on the face side.
G19 · YZ plane
Arcs lie in the YZ plane, centre with J and K.
G20 · Inches
All dimensions and feed rates are in inches (1 inch = 25.4 mm). Careful: a program in inches cuts completely different sizes if you take it for millimetres. The app always generates millimetres.
G21 · Millimetres
All dimensions in millimetres, feed in mm/min. Default in Grbl and in every program from the app.
G28 · Go to stored position 1
Moves at rapid speed to the machine position stored with G28.1. With axis words it first passes through that intermediate point. Careful: if nothing is stored, the target is the machine zero. For parking, the app prefers its own park position.
G28.1 · Store position 1
Stores the current machine position permanently as the target for G28.
G30 · Go to stored position 2
Like G28, but with the second stored position (G30.1). Often used as tool-change position.
G30.1 · Store position 2
Stores the current machine position permanently as the target for G30.
G38.2 · Probe toward contact
Moves at feed F toward the target until the probe reports contact, and stops there. Without contact you get alarm 5. The Z probe wizard uses it to measure the material surface.
Example:
G91 G38.2 Z-20 F100
G38.3 · Probe without alarm
Like G38.2, but without an alarm if no contact is made. Whether it worked is shown afterwards in the probe report [PRB:…:1].
G38.4 · Probe away from contact
Moves until the probe loses contact; with an alarm if that does not happen.
G38.5 · Probe away without alarm
Like G38.4, but without an alarm.
G40 · Cutter compensation off
Grbl has no cutter compensation but accepts G40 so that programs from other software run. The app already includes the bit radius in the toolpaths.
G43.1 · Dynamic tool length offset
Shifts Z by the given value, for example after changing to a longer bit. Stays in effect until G49 or reset.
Example:
G43.1 Z1.25
G49 · Tool length offset off
Cancels a tool length offset from G43.1.
G53 · Machine coordinates
Applies to this one line only: the target values are machine coordinates instead of work coordinates. Only works together with G0 or G1. The app uses it to move safely all the way up, for example when parking.
Example:
G53 G0 Z-1
G54 · Work coordinate system 1
The default coordinate system. Its zero is the work zero you set in the app. G55 to G59 are five more, for example for several clamped parts.
G55 bis G59 · More coordinate systems
Five additional work coordinate systems with their own stored zeros. Switch with the command; $# shows the zeros in the console.
G61 · Exact path mode
Grbl always runs in exact path mode and only accepts G61. How much corners are rounded is controlled by $11.
G80 · Motion mode off
Ends the active motion mode. Afterwards axis words alone do not cause any motion (error 31). Grbl 1.1 does not know drilling cycles like G81; the app writes holes as single moves.
G90 · Absolute positioning
Targets refer to the zero point. X10 means »move to X = 10«. Default.
G91 · Incremental positioning
Targets are distances from the current position. X10 means »move 10 mm further in X«. A forgotten G91 is a common cause of unexpected moves; set G90 again afterwards.
G91.1 · Incremental arc centre
I, J, K are relative to the arc start. Grbl only supports this mode.
G92 · Temporary coordinate offset
Temporarily gives the current position new coordinates. The offset is lost after a restart and overlays G54 to G59, which easily confuses. The app uses G10 L20 instead.
Example:
G92 X0 Y0
G92.1 · Clear G92 offset
Cancels an offset from G92.
G93 · Inverse time feed
F states how many times per minute the move would be performed (that is 1/minutes). Only for special programs; every line then needs its own F.
G94 · Units per minute feed
Normal feed mode: F in mm/min (or inch/min with G20). Default.