G-code reference
G51.2 G-Code: Polygon Turning
Polygon Turning — Fanuc lathe function that synchronises a rotating tool axis with the spindle at a fixed ratio, so a fly cutter produces flats (squares, hexagons) on a turning…
| Property | Value |
|---|---|
| Code | G51.2 |
| Function | Polygon Turning |
| Modal group | 20 |
| Type | Modal — stays active until replaced by another code of the same group |
| Used on | Lathes |
| Syntax | G51.2 P_ Q_ |
What does G51.2 do?
Fanuc lathe function that synchronises a rotating tool axis with the spindle at a fixed ratio, so a fly cutter produces flats (squares, hexagons) on a turning part in seconds. G50.2 cancels.
G51.2 is modal: once programmed it remains in effect for the following blocks until another code from modal group 20 replaces it or the control is reset.
Syntax and parameters
G51.2 P_ Q_| Address | Meaning |
|---|---|
P | Spindle speed ratio part |
Q | Tool speed ratio part (sign = direction) |
G51.2 example program
M03 S1000
G51.2 P1 Q2 (tool turns twice per spindle turn)
G01 X40.0 F0.1
G50.2▶ Open this example in the G-code viewer
Tips and common mistakes
- Flats are slightly convex — fine for wrenches and nuts, not for precision faces.
Controller compatibility
G51.2 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.