G-code reference
G30 G-Code: Return to 2nd/3rd/4th Reference Point
Return to 2nd/3rd/4th Reference Point — Like G28 but goes to a secondary reference position set by parameter, often used as a tool-change position on lathes or a part-loading position.
| Property | Value |
|---|---|
| Code | G30 |
| Function | Return to 2nd/3rd/4th Reference Point |
| Modal group | 00 |
| Type | One-shot (non-modal) — active only in its own block |
| Used on | Mills and lathes |
| Syntax | G30 P2 U0 W0 |
What does G30 do?
Like G28 but goes to a secondary reference position set by parameter, often used as a tool-change position on lathes or a part-loading position.
G30 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
G30 P2 U0 W0| Address | Meaning |
|---|---|
P2–P4 | Which reference point (P2 if omitted) |
G30 example program
G30 U0 W0 (lathe: go to tool change position)▶ Open this example in the G-code viewer
Tips and common mistakes
- The position is a machine parameter — check where it is before running.
Controller compatibility
G30 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.