## PROGRAMMING G-CODE

### PROGRAMMING G-CODE

Read the following sections as a G-code reference:

Many commands require axis words (X~, Y~ ,Z~, or A~) as an argument. Unless explicitly stated otherwise, you can make the following assumptions:

• Axis words specify a destination point
• Axis words relate to the currently active coordinate system, unless explicitly described as being in the absolute coordinate system
• Where axis words are optional, any omitted axes retain their current value

Any items in the command examples not explicitly described as optional are required.

## SPINDLE CONTROL MODE (G96 AND G97)

### SPINDLE CONTROL MODE (G96 AND G97)

To set constant surface speed mode, program: G96 D~ S~

• D~ is the maximum spindle RPM. This word is optional.
• S~ is the surface speed.

NOTE: If G20 is the active mode, the value is interpreted as feet per minute. If G21 is the active mode, the value is interpreted as meters per minute

EXAMPLE – G96 D2500 S250 (set constant surface speed with a maximum RPM of 2500, and a surface speed of 250).

It’s an error if:

• S is not specified with G96
• A feed move is specified in G96 mode while the spindle is not turning

When using G96 (the most common mode of mill operation), X0 in the current coordinate system (including offsets and tool lengths) must be the spindle axis.

To set RPM mode, program: G97

## FEED RATE MODE (G93, G94, AND G95)

### FEED RATE MODE (G93, G94, AND G95)

To set the active feed rate mode to inverse time, program: G93

Inverse time is used to program simultaneous coordinated linear and coordinated rotary motion. In inverse time feed rate mode, an F word means the move should be completed in [1/F number] minutes.

EXAMPLE – If the F number is 2.0, the move should be completed in half a minute.

When the inverse time feed rate mode is active, an F word must appear on every line which has a G01, G02, or G03 motion, and an F word on a line that does not have G01, G02, or G03 is ignored. Being in inverse time feed rate mode does not affect G00 (rapid traverse) motions.

To set the active feed rate mode to units per minute mode, program: G94

In units per minute feed rate mode, an F word is interpreted to mean the controlled point should move at a certain number of inches per minute, or millimeters per minute, depending upon what length units are being used.

To set the active feed rate mode to units per revolution mode, program: G95

In units per revolution mode, an F word is interpreted to mean the controlled point should move a certain number of inches per revolution of the spindle, depending on what length units are being used. G95 is not suitable for threading, for threading use G33 or G76.

#### TROUBLESHOOTING

It’s an error if:

• Inverse time feed rate mode is active and a line with G01, G02, or G03 (explicitly or implicitly) does not have an F word
• A new feed rate is not specified after switching to G94 or G95 canned cycle return level – G98 and G99

## TEMPORARY WORK OFFSETS (G92, G92.1, G92.2, AND G92.3)

### TEMPORARY WORK OFFSETS (G92, G92.1, G92.2, AND G92.3)

IMPORTANT! This is a legacy feature. Most modern programming methods don’t use temporary work offsets.

To apply a temporary work offset, program: G92 X~ Y~ Z~ A~

• X~ is the X-axis coordinate
• Y~ is the Y-axis coordinate
• Z~ is the Z-axis coordinate
• A~ is the A-axis coordinate

G92 reassigns the current controlled point to the coordinates specified by the axis words (X~, Y~, Z~, and/or A~). No motion takes place.

The axis words are optional, except that at least one must be used. If an axis word is not used for a given axis, the coordinate on that axis of the current point is not changed. Incremental distance mode (G91) has no effect on the action of G92.

When G92 is executed, it is applied to the origins of all coordinate systems (G54 through G59.3).

EXAMPLE – If the current controlled point is at X = 4, and there is currently no G92 offset active, and then G92 X7 is programmed, this reassigns the current controlled point to X = 7 — effectively moving the origin of the active coordinate system -3 units in X. The origins of all inactive coordinate systems also move -3 units in X. This -3 is saved in parameter 5211.

G92 offsets may be already be in effect when the G92 is called. If this is the case, the offset is replaced with a new offset that makes the current point become the specified value.

It’s an error if:

• All axis words are omitted

PathPilot stores the G92 offsets and reuses them on the next run of a program. To prevent this, you can program a G92.1 (to erase them), or program a G92.2 (to stop them being applied – they are still stored).

To reset axis offsets to zero and sets parameters 5211 – 5219 to zero, program: G92.1

To reset axis offsets to zero, program: G92.2

To set the axis offset to the values saved in parameters 5211 to 5219, program: G92.3

## ARC DISTANCE MODE (G90.1 AND G91.1)

### ARC DISTANCE MODE (G90.1 AND G91.1)

G90.1 – Absolute distance mode for I and K offsets. When G90.1 is in effect, I and K both must be specified with G02/G03 for the XZ plane or it is an error.

G91.1 – Incremental distance mode for I and K offsets. G91.1 returns I and K to their default behavior.

## DISTANCE MODE (G90 AND G91)

### DISTANCE MODE (G90 AND G91)

Interpretation of the operating system code can be in one of two distance modes: absolute or incremental.

To go into absolute distance mode, program: G90.

In absolute distance mode, axis numbers (X, Y, Z, A) usually represent positions in terms of the currently active coordinate system. Any exceptions to that rule are described explicitly in this section.

To go into incremental distance mode, program: G91.

In incremental distance mode, axis numbers (X, Y, Z, A) usually represent increments from the current values of the numbers. I and J numbers always represent increments, regardless of the distance mode setting. K numbers represent increments.

## SET BLENDED PATH CONTROL MODE (G64)

### SET BLENDED PATH CONTROL MODE (G64)

To attempt to maintain the defined feed velocity, program: G64 P~ Q~

• P~ is, if present, the maximum acceptable tool path deviation to round corners to maintain speed – If P is omitted then the speed is maintained however far from the programmed path the tool cuts.
• Q~ is, if present, the maximum deviation from collinearity that will collapse a series of linear G01 moves at the same feed rate into a single linear move

It’s okay to program for the mode that is already active.

## SET EXACT PATH CONTROL MODE (G61)

### SET EXACT PATH CONTROL MODE (G61)

To put the machining system into exact path mode, program: G61

## SELECT WORK OFFSET COORDINATE SYSTEM (G54 TO G59.3)

### SELECT WORK OFFSET COORDINATE SYSTEM (G54 TO G59.3)

To select a work offset coordinate system, program: G54, G55, …, as follows:

• To select Coordinate System 1, program: G54
• To select Coordinate System 2, program: G55
• To select Coordinate System 3, program: G56
• To select Coordinate System 4, program: G57
• To select Coordinate System 5, program: G58
• To select Coordinate System 6, program: G59
• To select Coordinate System 7, program: G59.1
• To select Coordinate System 8, program: G59.2
• To select Coordinate System 9, program: G59.3

#### TROUBLESHOOTING

It’s an error if:

• One of these G-codes is used while cutter radius compensation is on
• The X- and Z-axis work offset values are stored in parameters corresponding to the system in use (i.e., System 1 X=5221, Z=5223; System 2 X=5141, Z=5143; up to System 9 X= 5381, Z = 5383).

## ABSOLUTE COORDINATES (G53)

### ABSOLUTE COORDINATES (G53)

For rapid linear motion to a point expressed in absolute coordinates, program: G01 G53 X~ Y~ Z~ (or use with G00 instead of G01)

All the axis words are optional, except that at least one must be used. The G00 or G01 is optional if it is in the current motion mode. G53 isn’t modal, and must be programmed on each line on which it is intended to be active. This produces coordinated linear motion to the programmed point. If G01 is active, the speed of motion is the current feed rate (or slower if the mill won’t go that fast). If G00 is active, the speed of motion is the current traverse rate (or slower if the mill won’t go that fast).

#### TROUBLESHOOTING

It’s an error if:

• G53 is used without G00 or G01 being active
• G53 is used while cutter radius compensation is on