Select G-Code Definitions (Expanded)

G0 - Rapid Move

This code commands the machine to move as fast as it can to a specified point. It is always used with a coordinate position and is modal. Unlike G1, G0 does not coordinate the axes to move in a straight line. Rather, each axis moves at its maximum speed until it is satisfied. This results in "dogleg" motion as shown in Figure 5.1, below.

G0 X0. Y0.

Figure 5.1: G0 Dogleg Motion

Caution: The rapid speed of some machines can exceed 1. An incorrect offset or coordinate move can crash the machine faster than the operator can hit the emergency stop. Use the rapid feed override on the machine when running a program for the first time.

G1 - Linear Move

This command moves the tool in a straight line at a programmed feed rate.

G1 X1. Y1.1255 F32.

G2/G3 - CW/CCW Arc

G2 commands clockwise arcs. G3 commands counterclockwise arcs. Arcs must exist on a plane (G17/G18/G19) and include the coordinates of the arc end point and IJK vectors indicating the arc center location.

Figure 5.2: G2/G3 Arcs

G17/G18/G19 - Plane Designation

Arcs must exist on a plane designated by the command G17 (XY), G18 (XZ) or G19 (YZ). G17 is the machine default.

Figure 5.3: Plane Designations

G40/G41/G42 - Cutter Diameter Compensation (CDC)

CDC is a key to precision CNC machining, allowing the operator to compensate for tool wear and deflection by commanding the machine to veer left (G41) or right (G42) from the programmed path. G40 cancels cutter compensation. The amount of offset is entered in a CNC control D-register. The wear register can be thought of like a table that the control refers to with every move.

Tool Diameter OffsetValue

Table 5.5: Diameter Offset Register

The value in the D-register is calculated by the machine tool operator, who monitors the finished size of part features, compares them with the print, and enters the difference in the register as needed to keep the part within specifications. If there is no deviation, the register is set to zero.

G1 G41 D1 X1.0 Y.25 F36.

G43 - Tool Length Compensation

G43 activates tool length compensation. It is always accompanied by an H-code and Z-move, where H is the tool length offset (TLO) register to read, and Z is the height to go to in reference to the part datum.

The (TLO) can be thought of like a table on the control:

Tool Length ResisterZ

Table 5.6: Work Offsets

The TLO is combined with the active fixture offset on the control so the machine knows where the tip of the tool is in relation to the part datum. The process for finding the TLO is detailed in Chapter 6: CNC Operation.

G43 H1 Z1.

G54 - Work Offset

Work offsets are data registers in the CNC control that hold the distance from the machine home X, Y, Z position to the part datum. These offsets can be thought of like a table on the control:

Work OffsetXYZ

Table 5.7: Work Offsets

Tip: G54 is usually used for the first machining setup. Additional offsets are used to machine other sides of the part.

The X and Y values represent the distance from the machine home to part datum XY. The Z value is the distance from the tool reference point (for example, the top of a 1-2-3 block) and the part Z-datum. The process for finding TLO and fixture offset Z is detailed in Chapter 6: CNC Operation.

G54 X0. Y0.