G54 to G59: Work Coordinate Systems (and G53)
G54 to G59 pick which work offset is active, so X0 Y0 Z0 in the program is the part's zero. G53 moves in machine coordinates for a single line.
The machine knows its own position from machine zero, the point it finds when it homes. Your part could be anywhere on the table. A work offset stores the distance from machine zero to the part zero you picked, such as the top-left corner of the stock. With a work offset active, X0 Y0 Z0 in the program means that corner.
The six standard work offsets
| Code | Work coordinate system |
|---|---|
| G54 | 1 (the default on most controls) |
| G55 | 2 |
| G56 | 3 |
| G57 | 4 |
| G58 | 5 |
| G59 | 6 |
All six are modal: once selected, an offset stays active until another one is called. Programs normally state the offset in the safety line at the start, for example G21 G17 G90 G54.
Running several parts with one program
A common use is one vise per offset. You set G54 on the first part and G55 on the second, and the program runs the same toolpath twice:
G54
(toolpath for part 1)
G55
(the same toolpath for part 2)
Because the code is identical apart from the offset, you only have to prove out one toolpath.
Extended work offsets
Six isn't always enough for fixtures with many parts:
- Fanuc:
G54.1 P1toG54.1 P48(more with an option). - Haas:
G154 P1toG154 P99. The first 20 can also be called as G110 to G129. - LinuxCNC: G59.1, G59.2 and G59.3, for nine in total.
- GRBL: the six standard offsets only.
Setting offsets in the program with G10
Offsets are usually set at the machine by touching off. They can also be set from the program:
G10 L2 P1 X-250 Y-180 Z-90sets offset 1 (G54) to those machine coordinates. Fanuc, Haas, LinuxCNC and GRBL all support it.G10 L20 P1 X0 Y0 Z0(LinuxCNC and GRBL) sets offset 1 so that the current position becomes X0 Y0 Z0.
G53: machine coordinates
G53 ignores the active work offset for one line only and moves in machine coordinates. It's non-modal, so the next line is back in the work offset.
G53 G0 Z0
This raises the spindle to machine Z zero, normally the top of travel, whatever work offset is active. Haas programs use it before tool changes and at the end of a program. Use it with G0 or G1 in absolute mode (G90).
G53 is different from G28: G53 moves straight to the machine position you give, with no intermediate point.
How CutViewer shows G54 to G59 and G53
CutViewer tracks which work offset is active and shows it in the status bar, but it doesn't know your offset values. Everything is drawn in program coordinates, so toolpaths for G54 and G55 appear on top of each other rather than side by side.
CutViewer also doesn't know your machine coordinates, so it doesn't draw G53 moves: the next move is drawn from the last position it knows. A line such as G53 G0 Z0 at the end of a program won't show as a move into the part.
Frequently Asked Questions
What does G54 mean in G-code?
G54 selects the first work coordinate system. The control adds the G54 offset, measured from machine zero to your part zero, to every position in the program. G54 is the default on most controls.
Why use more than one work offset?
To run several parts or fixtures in one program. Each vise or part gets its own offset, G54 for the first and G55 for the second, and the same toolpath runs on each by switching offsets.
What is G53 used for?
G53 moves in machine coordinates for one line only, ignoring the work offset. G53 G0 Z0 is a common way to raise the spindle to the top of its travel before a tool change, whatever offset is active.
How many work offsets are there?
Six standard ones, G54 to G59. Fanuc adds up to 48 or more with G54.1 P1 to P48, Haas adds G154 P1 to P99, and LinuxCNC adds G59.1, G59.2 and G59.3. GRBL has the six standard offsets only.
More G-Code Guides
Rapid positioning and straight cutting moves.
Clockwise and counter-clockwise arcs with I/J/K or R.
Pause for a set time, in seconds or milliseconds.
Choose the XY, XZ or YZ plane for arcs.
Inch or millimetre units for the program.
Return to home or a second reference position.
Cutter radius compensation, left, right and off.
Tool length offset on and off.
Drilling canned cycles, from plain drilling to peck drilling.
Tapping cycle, and how to work out the feed rate.
Absolute positions or incremental distances.
Set the current position by shifting coordinates.
Feed per minute, per revolution, or inverse time.
Constant surface speed or a fixed spindle RPM.
Where a drilling cycle retracts between holes.
Spindle, coolant, tool change, stop and subprogram codes.
Check your own program before you cut: open it in CutViewer to see the toolpath in 3D, the run time and any problems.
Open CutViewer