Home › G-codes › LinuxCNC Tormach › G21
G21 Millimeter units
LinuxCNC Tormach G-code · Mill and lathe
Sets program units to millimeters for positions and feed rates.
Format
G21
Addresses
| Address | What it does |
|---|---|
none | No words |
How it works
Modal, units group.
Example program
G21 G17 G40 G49 G54 G80 G90 G94 (METRIC, SAFE START)
T1 M6 G43
S3000 M3
G0 X25 Y25 Z2 (MM POSITIONS)
T1 M6 G43
S3000 M3
G0 X25 Y25 Z2 (MM POSITIONS)
Example is in inch. Check offsets and clearances first.
Watch out for
- Running an inch program in G21 makes every move 25.4 times too small. Always state the units.
- Keep one unit per program.
Related codes
G21 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Fanuc | Metric input |
| Haas NGC | Metric programming check |
| Mazak (EIA) | Metric input |
| Okuma OSP | Metric input confirmation |
| Mitsubishi M70 M80 | Metric input |
| Brother Speedio | Metric input |
| Mach3 Mach4 | Metric units |
| Centroid CNC12 Acorn | Metric units |
| Hurco WinMax (NC) | Metric input (ISNC) |
| Fadal | Check for metric setting |
| Swiss (Citizen Star) | Metric input |
Every G-code for LinuxCNC Tormach in your pocket. The app has the full example programs, search by number or shop word, a line decoder and calculators for tapping, threading and drilling.
Open G21 in the app All LinuxCNC Tormach G-codes