G21 Metric input
Fanuc G-code · Mill, Lathe
On mills: Metric input
Sets the program units to millimeters. All positions, feeds and offsets in the program are read as metric values.
Format
G21
How it works
Modal, group 06. Stays through power off.
Example program
O2000 (METRIC PART)
G21 (METRIC)
G17 G40 G49 G80 G90 (SAFE START)
G21 (METRIC)
G17 G40 G49 G80 G90 (SAFE START)
Example is in inch. Check offsets and clearances first.
Watch out for
- Give G21 at the start of the program in its own block.
- A metric program run in G20 moves 25.4 times farther than planned. Check the mode on the screen.
On lathes: Metric input
Sets the program units to millimeters. Put it at the start of the program before any coordinates.
Format
G21
How it works
Modal, group 06. Stays on after power off.
Example program
%
O1001 (METRIC PART)
G21 (METRIC)
G18 G40 G99 (SAFETY LINE)
O1001 (METRIC PART)
G21 (METRIC)
G18 G40 G99 (SAFETY LINE)
Example is in inch. Check offsets and clearances first.
Watch out for
- A metric program run in G20 will move 25.4 times too far.
- Work and tool offsets are not converted when you switch.
Related codes
G21 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Haas NGC | Metric programming check |
| Mazak (EIA) | Metric input |
| Okuma OSP | Metric input confirmation |
| Mitsubishi M70 M80 | Metric input |
| Brother Speedio | Metric input |
| LinuxCNC Tormach | Millimeter units |
| 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 Fanuc 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 Fanuc G-codes