This page covers the following G-codes: G10, G52, G53, G54-G59. All these commands influence the behavior of the coordinate systems in the program.

Why change the coordinate system in a CNC program?

There are two main cases to “play around” with the coordinate systems in a G code program:

  1. When there are multiple blanks clamped in the machine pallet
  2. When a particular part has identical geometrical features repeated at different locations.

Pallets with multiple blanks (G54 – G59)

Gcode Coordinate Systems G54 - G59

A common practice in CNC Milling is to place multiple blanks on a pallet and have the machine manufacture them together. This technique saves machining time and workload on the operator. The same CNC program executes multiple times, and the program’s datum shifts between the blank locations.

G54, G55, G56, G57, G58, and G59 choose the active coordinate system. G10 command defines the datum of the coordinate system relative to the machine’s datum.

Program Example:

N10 G10 P1 X50.0 Y50.0 (Setting the Datum of G54)
N20 G10 P2 X50.0 Y250.0 (Setting the Datum of G55)
N30 G10 P2 X50.0 Y450.0 (Setting the Datum of G56)
N40 G10 P1 X250.0 Y50.0 (Setting the Datum of G57)
N50 G10 P2 X250.0 Y250.0 (Setting the Datum of G58)
N60 G10 P2 X250.0 Y450.0 (Setting the Datum of G59)
N70 G54; (Switched the Datum 0,0 to the origin of the 1st pallet)
N80 M98 P1000 (Call the program to machine the part)
N80 G55; (Switched the Datum 0,0 to the origin of the 2nd pallet)
N90 M98 P1000 (Call the program to machine the part)
.
.
.
And so on…

Notice!

As an alternative to G10, on most machines, the datum values can also be set by parameters on the controller

GCODE G52: Repetitive features on the same part

Gcode Coordinate System G52

Many mechanical parts have a repeated identical geometrical feature. If there is a single blank on the pallet, you can use the G54-G59 technique described above. However, if you have multiple blanks on the pallet, a common way to handle additional datums within the workpiece is with G52.

* G52 sets a temporary coordinate system relative to the previously selected coordinate system.

Program Example:

G54 (Select datum for the 1st part)
G52 X50 Y20 (Shifts the datum to the location of the 1st feature on the part)
M98 P2000 (Machine the feature)
G52 X150 Y20 (Shifts the Datum to the next feature on the part)
M98 P2000 (Machine the feature)
.
.
.
And so on…

Learn about more G-Codes

Scroll to Top