G-code reference
G31 G-Code: Skip Function (Probing Move)
Skip Function (Probing Move) — Moves like G01 until the skip signal (usually a touch probe) triggers. The axis then stops and the trigger position is stored in system variables (#5061–#5066…
| Property | Value |
|---|---|
| Code | G31 |
| Function | Skip Function (Probing Move) |
| Modal group | 00 |
| Type | One-shot (non-modal) — active only in its own block |
| Used on | Mills and lathes |
| Syntax | G31 X_ Y_ Z_ F_ |
What does G31 do?
Moves like G01 until the skip signal (usually a touch probe) triggers. The axis then stops and the trigger position is stored in system variables (#5061–#5066 on Fanuc).
G31 is a one-shot code: it only acts in the block where it is written, and the previously active modal codes take over again afterwards.
Syntax and parameters
G31 X_ Y_ Z_ F_| Address | Meaning |
|---|---|
X Y Z | Target (must lie beyond the expected contact) |
F | Probing feed |
G31 example program
G31 Z-20.0 F100.
#100 = #5063 (Z skip position)▶ Open this example in the G-code viewer
Tips and common mistakes
- If no contact occurs the move completes — macros must check for that.
- Use slow, constant feed for repeatable measurements.
- Renishaw cycles (O9810/9811) wrap G31 with protected moves.
Controller compatibility
G31 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.