2012-08-04 20:35:18 (CET)

G Codes ( G81 - G99 )

Canned Cycles - G81 to G89

The canned cycles G81 through G89 have been implemented as described in this section. Two examples are given with the description of G81 below.

 

All canned cycles are performed with respect to the currently selected plane. Any of the three planes (XY, YZ, and ZX) may be selected. Throughout this section, most of the descriptions assume the XY-plane has been selected. The behavior is always analogous if the YZ or XZ-plane is selected.

 

Rotational axis words are allowed in canned cycles, but it is better to omit them. If rotational axis words are used, the numbers must be the same as the current position numbers so that the rotational axes do not move.

 

All canned cycles use X, Y, R, and Z numbers in the NC code. These numbers are used to determine X, Y, R, and Z positions. The R (usually meaning retract) position is along the axis perpendicular to the currently selected plane (Z-axis for XY-plane, X-axis for YZ-plane, Y-axis for XZ-plane). Some canned cycles use additional arguments.

 

For canned cycles, we will call a number "sticky" if, when the same cycle is used on several lines of code in a row, the number must be used the first time, but is optional on the rest of the lines. Sticky numbers keep their value on the rest of the lines if they are not explicitly programmed to be different. The R number is always sticky.

 

In incremental distance mode: when the XY-plane is selected, X, Y, and R numbers are treated as increments to the current position and Z as an increment from the Z-axis position before the move involving Z takes place; when the YZ or XZ-plane is selected, treatment of the axis words is analogous. In absolute distance mode, the X, Y, R, and Z numbers are absolute positions in the current coordinate system.

 

The L number is optional and represents the number of repeats. L=0 is not allowed. If the repeat feature is used, it is normally used in incremental distance mode, so that the same sequence of motions is repeated in several equally spaced places along a straight line. In absolute distance mode, L > 1 means "do the same cycle in the same place several times," Omitting the L word is equivalent to specifying L=1. The L number is not sticky.

 

When L>1 in incremental mode with the XY-plane selected, the X and Y positions are determined by adding the given X and Y numbers either to the current X and Y positions (on the first go-around) or to the X and Y positions at the end of the previous go-around (on the repetitions). The R and Z positions do not change during the repeats.

 

The height of the retract move at the end of each repeat (called "clear Z" in the descriptions below) is determined by the setting of the retract mode: either to the original Z position (if that is above the R position and the retract mode is G98, OLD_Z), or otherwise to the R position. See Section 3.5.20

 

It is an error if:

  • X, Y, and Z words are all missing during a canned cycle,

  • a P number is required and a negative P number is used,

  • an L number is used that does not evaluate to a positive integer,

  • rotational axis motion is used during a canned cycle,

  • inverse time feed rate is active during a canned cycle,

  • cutter radius compensation is active during a canned cycle.

 

When the XY plane is active, the Z number is sticky, and it is an error if:

  • the Z number is missing and the same canned cycle was not already active,

  • the R number is less than the Z number.

 

When the XZ plane is active, the Y number is sticky, and it is an error if:

  • the Y number is missing and the same canned cycle was not already active,

  • the R number is less than the Y number.

 

When the YZ plane is active, the X number is sticky, and it is an error if:

  • the X number is missing and the same canned cycle was not already active,

  • the R number is less than the X number.

 

Preliminary and In-Between Motion

 

At the very beginning of the execution of any of the canned cycles, with the XY-plane

selected, if the current Z position is below the R position, the Z-axis is traversed to the R position. This happens only once, regardless of the value of L.

 

In addition, at the beginning of the first cycle and each repeat, the following one or two moves are made:

  1. a straight traverse parallel to the XY-plane to the given XY-position,

  2. a straight traverse of the Z-axis only to the R position, if it is not already at the R position.

 

If the XZ or YZ plane is active, the preliminary and in-between motions are analogous.

 

G81 Cycle

 The G81 cycle is intended for drilling. Program G81 X… Y… Z… A… R… L…
  1. Preliminary motion, as described above.

  2. Move the Z-axis only at the current feed rate to the Z position.

  3. Retract the Z-axis at traverse rate to clear Z.

 

 

Example: Suppose the current position is (1, 2, and 3) and the XY-plane has been selected, and the following line of NC code is interpreted.

 

G90 G81 G98 X4 Y5 Z1.5 R2.8


This calls for absolute distance mode (G90) and OLD_Z retract mode (G98) and calls for the G81 drilling cycle to be performed once. The X number and X position are 4. The Y number and Y position are 5. The Z number and Z position are 1.5. The R number and clear Z are 2.8. Old Z is 3. The following moves take place.

  1. a traverse parallel to the XY-plane to (4,5,3)

  2. a traverse parallel to the Z-axis to (4,5,2.8)

  3. a feed parallel to the Z-axis to (4,5,1.5)

  4. a traverse parallel to the Z-axis to (4,5,3)

 

Example: Suppose the current position is (1, 2, and 3) and the XY-plane has been selected, and the following line of NC code is interpreted.

 

G91 G81 G98 X4 Y5 Z-0.6 R1.8 L3

 

This calls for incremental distance mode (G91) and OLD_Z retract mode (G98) and calls for the G81 drilling cycle to be repeated three times. The X number is 4, the Y number is 5, the Z number is -0.6 and the R number is 1.8. The initial X position is 5 (=1+4), the initial Y position is 7 (=2+5), the clear Z position is 4.8 (=1.8+3), and the Z position is 4.2 (=4.8-0.6). Old Z is 3.

The first move is a traverse along the Z-axis to (1,2,4.8), since old Z < clear Z.

The first repeat consists of 3 moves.

  1. a traverse parallel to the XY-plane to (5,7,4.8)

  2. a feed parallel to the Z-axis to (5,7, 4.2)

  3. a traverse parallel to the Z-axis to (5,7,4.8)

 

The second repeat consists of 3 moves. The X position is reset to 9 (=5+4) and the Y position to 12 (=7+5).

  1. a traverse parallel to the XY-plane to (9,12,4.8)

  2. a feed parallel to the Z-axis to (9,12, 4.2)

  3. a traverse parallel to the Z-axis to (9,12,4.8)

 

The third repeat consists of 3 moves. The X position is reset to 13 (=9+4) and the Y position to 17 (=12+5).

  1. a traverse parallel to the XY-plane to (13,17,4.8)

  2. a feed parallel to the Z-axis to (13,17, 4.2)

  3. a traverse parallel to the Z-axis to (13,17,4.8)

 

G82 Cycle

 The G82 cycle is intended for drilling. Program G82 X… Y… Z… A… R… L… P…
  1. Preliminary motion, as described above.

  2. Move the Z-axis only at the current feed rate to the Z position.

  3. Dwell for the P number of seconds.

  4. Retract the Z-axis at traverse rate to clear Z.

 

G83 Cycle

The G83 cycle (often called peck drilling) is intended for deep drilling or milling with chip breaking. The retracts in this cycle clear the hole of chips and cut off any long stringers (which are common when drilling in aluminum). This cycle takes a Q number which represents a "delta" increment along the Z-axis. Program G83 X… Y… Z… A… R… L… Q…
  1. Preliminary motion, as described above.

  2. Move the Z-axis only at the current feed rate downward by delta or to the Z position, whichever is less deep.

  3. Rapid back out to the clear_z.

  4. Rapid back down to the current hole bottom, backed off a bit.

  5. Repeat steps 1, 2, and 3 until the Z position is reached at step 1.

  6. Retract the Z-axis at traverse rate to clear Z.

 

It is an error if:

• the Q number is negative or zero.

 

G85 Cycle

The G85 cycle is intended for boring or reaming, but could be used for drilling or milling. Program G85 X… Y… Z… A… B… C… R… L…

Preliminary motion, as described above.

Move the Z-axis only at the current feed rate to the Z position.

Retract the Z-axis at the current feed rate to clear Z.

 

G86 Cycle

The G86 cycle is intended for boring. This cycle uses a P number for the number of seconds to dwell. Program G86 X… Y… Z… A… B… C… R… L… P…

Preliminary motion, as described above.

Move the Z-axis only at the current feed rate to the Z position.

Dwell for the P number of seconds.

Stop the spindle turning.

Retract the Z-axis at traverse rate to clear Z.

Restart the spindle in the direction it was going.

 

The spindle must be turning before this cycle is used. It is an error if:

the spindle is not turning before this cycle is executed.

 

G87 Cycle

The G87 cycle is intended for back boring.

Program G87 X… Y… Z… A… R… L… I… J… K…

 

The situation, as shown in Figure 3-1, is that you have a through hole and you want to counter bore the bottom of hole. To do this you put an L-shaped tool in the spindle with a cutting surface on the UPPER side of its base. You stick it carefully through the hole when it is not spinning and is oriented so it fits through the hole, then you move it so the stem of the L is on the axis of the hole, start the spindle, and feed the tool upward to make the counter bore. Then you stop the tool, get it out of the hole, and restart it.

 

This cycle uses I and J numbers to indicate the position for inserting and removing the tool. I and J will always be increments from the X position and the Y position, regardless of the distance mode setting. This cycle also uses a K number to specify the position along the Z-axis of the controlled point top of the counter bore. The K number is a Z-value in the current coordinate system in absolute distance mode, and an increment (from the Z position) in incremental distance mode.

 

  1. Preliminary motion, as described above.

  2. Move at traverse rate parallel to the XY-plane to the point indicated by I and J.

  3. Stop the spindle in a specific orientation.

  4. Move the Z-axis only at traverse rate downward to the Z position.

  5. Move at traverse rate parallel to the XY-plane to the X,Y location.

  6. Start the spindle in the direction it was going before.

  7. Move the Z-axis only at the given feed rate upward to the position indicated by K.

  8. Move the Z-axis only at the given feed rate back down to the Z position.

  9. Stop the spindle in the same orientation as before.

  10. Move at traverse rate parallel to the XY-plane to the point indicated by I and J.

  11. Move the Z-axis only at traverse rate to the clear Z.

  12. Move at traverse rate parallel to the XY-plane to the specified X,Y location.

  13. Restart the spindle in the direction it was going before.

 

When programming this cycle, the I and J numbers must be chosen so that when the tool is stopped in an oriented position, it will fit through the hole. Because different cutters are made differently, it may take some analysis and/or experimentation to determine appropriate values for I and J.

 

G88 Cycle

The G88 cycle is intended for boring. This cycle uses a P word, where P specifies the

number of seconds to dwell. Program G88 X… Y… Z… A… R… L… P…

Preliminary motion, as described above.

  1. Move the Z-axis only at the current feed rate to the Z position.

  2. Dwell for the P number of seconds.

  3. Stop the spindle turning.

  4. Stop the program so the operator can retract the spindle manually.

  5. Restart the spindle in the direction it was going.

 

G89 Cycle

The G89 cycle is intended for boring. This cycle uses a P number, where P specifies the

number of seconds to dwell. program G89 X… Y… Z… A… R… L… P…

  1. Preliminary motion, as described above.

  2. Move the Z-axis only at the current feed rate to the Z position.

  3. Dwell for the P number of seconds.

  4. Retract the Z-axis at the current feed rate to clear Z.

 

Set Distance Mode - G90 and G91

To make the current point have the coordinates you want (without motion), program G92 X… Interpretation of RS274/NGC 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, B, C) usually represent positions in terms of the currently active coordinate system. Any exceptions to that rule are described explicitly in this Section 3.5.

 

To go into incremental distance mode, program G91. In incremental distance mode, axis numbers (X, Y, Z, A, B, C) 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 in all but one usage (see Section 3.5.16.8), where the meaning changes with distance mode.

 

Coordinate System Offsets - G92, G92.1, G92.2, G92.3

To make the current point have the coordinates you want (without motion), program 

G92 X… Y… Z… A… , where the axis words contain the axis numbers you want. All 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.

 

It is an error if:

  • all axis words are omitted.

 

When G92 is executed, the origin of the currently active coordinate system moves. To do this, origin offsets are calculated so that the coordinates of the current point with respect to the moved origin are as specified on the line containing the G92. In addition, parameters 5211 to 5216 are set to the X, Y, Z, A, B, and C-axis offsets. The offset for an axis is the amount the origin must be moved so that the coordinate of the controlled point on the axis has the specified value.

 

Here is an example. Suppose the current point is at X=4 in the currently specified coordinate system and the current X-axis offset is zero, then G92 x7 sets the X-axis offset to -3, sets parameter 5211 to -3, and causes the X-coordinate of the current point to be 7.

 

The axis offsets are always used when motion is specified in absolute distance mode using any of the nine coordinate systems (those designated by G54 - G59.3). Thus all nine coordinate systems are affected by G92.

 

Being in incremental distance mode has no effect on the action of G92.

 

Non-zero offsets may already be in effect when the G92 is called. If this is the case, the new value of each offset is A+B, where A is what the offset would be if the old offset were zero, and B is the old offset. For example, after the previous example, the X-value of the current point is 7. If G92 x9 is then programmed, the new X-axis offset is -5, which is calculated by [[7-9] + -3].

 

To reset axis offsets to zero, program G92.1 or G92.2. G92.1 sets parameters 5211 to 5216 to zero, whereas G92.2 leaves their current values alone.

To set the axis offset values to the values given in parameters 5211 to 5216, program G92.3.

 

You can set axis offsets in one program and use the same offsets in another program. Program G92 in the first program. This will set parameters 5211 to 5216. Do not use G92.1 in the remainder of the first program. The parameter values will be saved when the first program exits and restored when the second one starts up. Use G92.3 near the beginning of the second program. That will restore the offsets saved in the first program. If other programs are to run between the program that sets the offsets and the one that restores them, make a copy of the parameter file written by the first program and use it as the parameter file for the second program.

 

Set Feed Rate Mode - G93 and G94

Two feed rate modes are recognized: units per minute and inverse time. Program G94 to start the units per minute mode. Program G93 to start the inverse time mode.

 

In units per minute feed rate mode, an F word (no, not that F word; we mean feed-rate) is interpreted to mean the controlled point should move at a certain number of inches per minute, millimeters per minute, or degrees per minute, depending upon what length units are being used and which axis or axes are moving.

 

In inverse time feed rate mode, an F word means the move should be completed in [one divided by the F number] minutes. For 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 G1, G2, or G3 motion, and an F word on a line that does not have G1, G2,

or G3 is ignored. Being in inverse time feed rate mode does not affect G0 (rapid traverse) motions.

 

It is an error if:

  • inverse time feed rate mode is active and a line with G1, G2, or G3 (explicitly or implicitly) does not have an F word.

 

Set Canned Cycle Return Level - G98 and G99

When the spindle retracts during canned cycles, there is a choice of how far it retracts:

(1) retract perpendicular to the selected plane to the position indicated by the R word, or

(2) retract perpendicular to the selected plane to the position that axis was in just before the canned cycle started (unless that position is lower than the position indicated by the R word, in which case use the R word position).

 

To use option (1), program G99. To use option (2), program G98. Remember that the R word has different meanings in absolute distance mode and incremental distance mode.