INTRODUCTION:
In VMC G-code, G98 and G99 are modal commands that control where the tool retracts to between holes or pecks in a canned drilling cycle. They are critical for safety and efficiency, preventing the tool from crashing into clamps, vises, or previously machined features when moving to the next hole. G98 and G99 are retract modes for canned cycles like G81, G82, G83, etc.
Imagine three key height levels when drilling a hole:
• Initial Height (Rapid Plane): Where the tool starts above the part.
• Retract Plane (R-level): A safe height above the part where the tool pulls back to between operations.
• Part Surface (Z-depth): The bottom of the hole.
G98 and G99 tell the machine which of the first two planes to return to.
G99: return to the R-level (initial point):
After drilling one hole, the tool will retract only back up to the R-plane i.e. a safe clearance above the part, typically 0.010" to 0.250" or 0.25mm to 5mm. It then rapid moves at this R-plane height to the XY position of the next hole.When to use G99:
· Most common for a series of holes in a flat part.· When there are no obstructions like clamps or tall features between the holes.
· It's faster because the tool takes the shortest path just above the part surface.
G98: return to the initial height :
After drilling one hole, the tool will retract all the way back up to the initial Z-height it started at before the cycle began. It then rapid moves at this much higher safe height to the XY position of the next hole.When to use G98:
· When there are obstructions like vises, clamps, tall fins on the part that the tool must clear.· At the end of a drilling cycle to ensure the tool is in a known, safe position before moving to another operation.
· When machining holes at different depths on a stepped part.
EXAMPLE:
(Example using a simple drilling cycle G81)
G54 G17 G20 G40 G80 G90 (Safety line)
T01 M06 (Tool 1 - Drill)
S1200 M03
G00 X1.0 Y1.0 (Rapid to first hole position)
G43 H01 Z0.5 (Rapid to initial height, tool length comp)
G99 G81 X1.0 Y1.0 R0.1 Z-0.5 F5.0 (G99 ACTIVE - Drill Hole 1, retract to R0.1)
X2.0 Y1.0 (Move & drill Hole 2 at R-plane)
X3.0 Y1.0 (Move & drill Hole 3 at R-plane)
G98 X4.0 Y2.0 (G98 OVERRIDE - Drill Hole 4, RETRACT TO INITIAL Z0.5)
G80 (Cancel drilling cycle)
M05
M30
In this program, holes 1, 2, and 3 are drilled using G99. The tool moves between them at Z0.1. Hole 4 is drilled using G98. After finishing hole 3, the tool goes back to Z0.5 (the initial height), safely rapids over to (X4.0, Y2.0), and then drills. Choose G99 for speed on open parts, and G98 for safety when you need to clear obstacles or at the end of an operation. Always visualize the toolpath in your CAM software or controller before running the program.
If we are given a canned drilling cycle (G81) with an R value. The question is: if we program G98 G81 XYR ZF, what will happen compared to G99 G81 XY RZ F?
In a G81 cycle, the typical sequence for one hole is:
G54 G17 G20 G40 G80 G90 (Safety line)
T01 M06 (Tool 1 - Drill)
S1200 M03
G00 X1.0 Y1.0 (Rapid to first hole position)
G43 H01 Z0.5 (Rapid to initial height, tool length comp)
G99 G81 X1.0 Y1.0 R0.1 Z-0.5 F5.0 (G99 ACTIVE - Drill Hole 1, retract to R0.1)
X2.0 Y1.0 (Move & drill Hole 2 at R-plane)
X3.0 Y1.0 (Move & drill Hole 3 at R-plane)
G98 X4.0 Y2.0 (G98 OVERRIDE - Drill Hole 4, RETRACT TO INITIAL Z0.5)
G80 (Cancel drilling cycle)
M05
M30
In this program, holes 1, 2, and 3 are drilled using G99. The tool moves between them at Z0.1. Hole 4 is drilled using G98. After finishing hole 3, the tool goes back to Z0.5 (the initial height), safely rapids over to (X4.0, Y2.0), and then drills. Choose G99 for speed on open parts, and G98 for safety when you need to clear obstacles or at the end of an operation. Always visualize the toolpath in your CAM software or controller before running the program.
If we are given a canned drilling cycle (G81) with an R value. The question is: if we program G98 G81 XYR ZF, what will happen compared to G99 G81 XY RZ F?
In a G81 cycle, the typical sequence for one hole is:
1. Rapid move to the initial plane or from the initial plane to the R-plane? Actually, the initial plane is the Z position when the cycle is called, and the R-plane is specified by the R word.
2. Rapid move from the initial plane to the R-plane if the initial plane is above the R-plane.
3. Feed move from the R-plane to the Z-depth.
4. Then, depending on G98 or G99:
• If G99: Rapid retract to the R-plane.
• If G98: Rapid retract to the initial plane.
When moving to the next hole, the tool will move at the retract plane either R-plane or initial plane to the next X Y position.
So, in your example:
Case 1: G99 G81 XYRZF
The tool will retract to the R-plane after each
hole and then move to the next hole at that
R-plane.
Case 2: G98 G81 XYRZF
The tool will retract to the initial plane i.e. the Z position when the cycle was called, let's say
Z_ initial after each hole and then move to the
next hole at that initial plane. Therefore, the difference is the retract height between holes.
Example:
Suppose we have:Initial Z (when calling the cycle): Z0.5
R:0.1
Z-depth:-0.5
For the first hole:
• The tool rapids from Z0.5 to Z0.1 (R-plane).
• Then feeds to Z-0.5.
• Then retracts.
Now, if using G99, it retracts to Z0.1 (R-plane) and then moves in XY to the next hole at Z0.1.
If using G98, it retracts to Z0.5 (initial plane) and then moves in XY to the next hole at Z0.5.
So, G98 is safer if there are obstacles like clamps because the tool goes higher between holes. G99 is faster because the tool doesn't go as high.
In your code, if you write:
G98 G81 X1.0 Y1.0 R0.1 Z-0.5 F5.0
Then for each hole including the first and
subsequent ones the tool will retract to the initial plane i.e. the Z position when the cycle was called, say Z0.5 after drilling.
The first rapid move in the cycle is from
the initial plane to the R-plane. So, for the first hole, the tool goes from Z0.5 (initial) to Z0.1 (R) rapidly, then feeds to Z-0.5, and then (because of G98) retracts rapidly back to Z0.5. Then, when moving to the next hole (if specified in the same cycle), it will move at Z0.5 (the initial plane) to the next XY and then rapid down to the R-plane (Z0.1) for that hole, feed to Z-0.5, and retract to Z0.5 again.
What will happen in peck drilling?
In peck drilling with G98, the tool retracts to the R-plane i.e. retract plane between pecks, and only after the final peck does it retract all the way to the initial plane.
Let me restate it clearly to confirm:
In peck drilling with G98, the tool retracts to the R-plane i.e. retract plane between pecks, and only after the final peck does it retract all the way to the initial plane.
Let me restate it clearly to confirm:
For G83 (full retract peck drilling):
During the pecking (G83): In both G98 and G99, the tool always retracts to the R-plane (the retract plane) between every peck to clear chips and allow coolant in. This happens regardless of whether you use G98 or G99.
After the final depth (hole complete):
After the final depth (hole complete):
This is the only time G98 and G99 behave differently.
• G98: After the very last peck hits the Z-depth, the tool pulls all the way back to the Initial Plane (the Z-height the tool was at before the G83 line).
• G99: After the last peck, the tool stays at the R-plane.
e.g.
G98 G83 X1.0 Y1.0 R0.1 Z-1.0 Q0.25 F5.0
· Peck 1: drill to Z-0.15 → retract to R0.1
· Peck 2: drill to Z-0.4 → retract to R0.1
· Peck 3: drill to Z-0.65 → retract to R0.1
· Peck 4: drill to Z-0.9 → retract to R0.1
· Final peck: drill to Z-1.0 → retract to Initial Z (e.g., Z1.0) because of G98.
If it were G99 instead, the final retract would be to R0.1. G98 only affects the very last retract of the cycle. Between pecks, the tool always goes to the R‑plane (for G83) or a short retract (for G73).
• G99: After the last peck, the tool stays at the R-plane.
e.g.
G98 G83 X1.0 Y1.0 R0.1 Z-1.0 Q0.25 F5.0
· Peck 1: drill to Z-0.15 → retract to R0.1
· Peck 2: drill to Z-0.4 → retract to R0.1
· Peck 3: drill to Z-0.65 → retract to R0.1
· Peck 4: drill to Z-0.9 → retract to R0.1
· Final peck: drill to Z-1.0 → retract to Initial Z (e.g., Z1.0) because of G98.
If it were G99 instead, the final retract would be to R0.1. G98 only affects the very last retract of the cycle. Between pecks, the tool always goes to the R‑plane (for G83) or a short retract (for G73).
0 Comments