Most common G[eometric] code commands#

Summary from LinuxCNC and all3dp.

Settings#

to include in the preamble of each G code file.

Code

Command

Info

$H

Homing

G4

Sleep

Usage: G4 Px (x = seconds)

G17

Plane Select: XY (default)

G20

Use inches for length units

G21

Use millimeters for length units

G90

Absolute Distance Mode

default mode: move to coordinates

G91

Incremental Distance Mode

G92

Coordinate System Offset

makes the current point have the coordinates you want

M2

Program End

Movements#

Code

Command

Info

F

Set Feed Rate

feedrate is already set to maximum in the startup blocks

G00

Rapid Move

non-drawing movements like initial and travel moves

G01

Linear Move

linear motion for drawing

Example#

$H ; unlock by homing
G21 ; unit is mm
G17 ; work in XY plane
G90 ; absolute distance mode
G01 Z-10 ; pen up
G00 X0.0000 Y0.0000 ; travel
G01 Z0 ; pen down
G01 X950.0000 Y950.0000 ; draw
G01 Z-10 ; pen up
G00 X0.0000 Y950.0000 ; travel
G01 Z0 ; pen down
G01 X950.0000 Y0.0000 ; draw
G01 Z-10 ; pen up
G00 X0 Y0 ; travel
M2 ; end