G98 is a G-code command that instructs the CNC machine to return to the initial point after each canned cycle operation. The initial point is the Z-axis position before the canned cycle is executed. This command is useful for avoiding collisions or interference with the workpiece or the fixture.
Usage format
The usage format of G98 is as follows:
G98
This command can be used in conjunction with any canned cycle, such as G81 (drilling cycle), G82 (counterboring cycle), G83 (peck drilling cycle), etc. The command should be placed on the same line as the canned cycle or before it.
Explanation
When G98 is active, the tool will return to the initial point (also called the R-plane) after each hole is machined. The initial point is the Z-axis position before the canned cycle is executed. The initial point can be specified by using the R word in the canned cycle line, or by using a G0 or G1 move before the canned cycle.
For example, consider the following program:
G0 Z0.1
(move to initial point)
G98 G81 X1 Y1 Z-1 R0.1 F10
(drill hole at X1 Y1 with G98)
X2 Y2
(drill hole at X2 Y2 with G98)
G80
(cancel canned cycle)
In this program, the tool will move to Z0.1 before drilling each hole, and return to Z0.1 after drilling each hole. This will ensure that the tool does not collide with the workpiece or the fixture when moving between holes.
Example
Here is a text diagram to illustrate how G98 works:
Z
^
|
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o | o | o | o |
| | | | | |
+---+-----+-----+-----+-----+----> X
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+------------------------------------> Y
The tool will drill a 4x4 matrix of holes with the following program:
G0 Z0.1 (move to initial point)
G98 G81 X1 Y1 Z-1 R0.1 F10 (drill hole at X1 Y1 with G98)
X2 (drill hole at X2 Y1 with G98)
X3 (drill hole at X3 Y1 with G98)
X4 (drill hole at X4 Y1 with G98)
Y2 (drill hole at X4 Y2 with G98)
X3 (drill hole at X3 Y2 with G98)
X2 (drill hole at X2 Y2 with G98)
X1 (drill hole at X1 Y2 with G98)
Y3 (drill hole at X1 Y3 with G98)
X2 (drill hole at X2 Y3 with G98)
X3 (drill hole at X3 Y3 with G98)
X4 (drill hole at X4 Y3 with G98)
Y4 (drill hole at X4 Y4 with G98)
X3 (drill hole at X3 Y4 with G98)
X2 (drill hole at X2 Y4 with G98)
X1 (drill hole at X1 Y4 with G98)
G80 (cancel canned cycle)
The tool path will look like this:
Z
^
|
| +-----+-----+-----+-----+
| | | | | |
| | o<-o<-o<-o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o->o->o->o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o<-o<-o<-o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o->o->o->o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o<-o<-o<-o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o->o->o->o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o<-o<-o<-o | |
| | | | | |
| +-----+-----+-----+-----+
| | | | | |
| | o->o->o->o | |
| | | | | |
+---+-----+-----+-----+-----+----> X
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+------------------------------------> Y
The tool will move up to Z0.1 after each hole, and down to Z-1 before each hole. This will avoid any collision or interference with the workpiece or the fixture.