G98 & G99: Retract Modes in Drilling Cycles – Safe Z Moves Demystified
In canned drilling cycles like G81, the tool retract height after drilling is critical for both safety and efficiency. This is where G98 and G99 come into play.
| G-Code | Mode | Return Position |
|---|---|---|
| G98 | Return to Initial (Rapid) Point | Usually Safe Z |
| G99 | Return to R Level | Just above hole |
Choosing the right mode prevents crashes and minimizes wasted motion.
🔍 What Are G98 and G99?
These codes modify how canned cycles return the tool after each hole. Let’s break it down:
🔹 G98: Return to Initial Z (safe)
- Returns to the position the tool was at before the canned cycle began
- Used when there are clamps, fixtures, or tall geometry in the way
G0 X10 Y10
G81 Z-10 R2 F100
G98 ; Retract to Z before G81 started (e.g., Z5 or Z100)
🔸 G99: Return to R level (faster)
- Returns to the R-plane, which is just above the part
- Faster than G98, but must be used only if it’s safe
G0 X10 Y10
G81 Z-10 R2 F100
G99 ; Retract only to R2 after each hole
🧪 Practical Example
Assume:
- Initial Z before G81:
Z100 - R level:
R2 - Final depth:
Z-10
G98 Behavior:
G0 X0 Y0 Z100
G81 Z-10 R2 F100
G98
X10 Y0 ; Drill, retract to Z100
X20 Y0 ; Drill, retract to Z100
G80
G99 Behavior:
G0 X0 Y0 Z100
G81 Z-10 R2 F100
G99
X10 Y0 ; Drill, retract to R2
X20 Y0 ; Drill, retract to R2
G80
⚠️ G98 vs G99: When to Use Which?
| Scenario | Use G98 | Use G99 |
|---|---|---|
| Clamps or obstacles on surface | ✅ | ❌ |
| Open flat surface | ❌ | ✅ |
| Long travel between holes | ✅ | ❌ |
| High-speed production | ❌ | ✅ |
Rule of thumb: Start with G98, then switch to G99 after visual/verbal confirmation that there’s clearance.
💡 Best Practice – Combine with Clearance Z
Set your initial rapid height (Z100), R level (R2), and final depth (Z-10) thoughtfully:
%
O3001 (G98 vs G99 Example)
G21 G17 G90 G40 G49
T1 M6
G0 X0 Y0
G43 H1 Z100
S1500 M3
M8
G0 X0 Y0
G81 Z-10 R2 F100
G98 ; Safe retract for first few holes
X20 Y0
X40 Y0
G99 ; Switch to faster retract
X60 Y0
X80 Y0
G80
G0 Z100
M30
%
🔧 CAM Configuration Tips
In most CAM software:
- G98/G99 options are set in the post-processor or operation settings.
- G98 is often the default, especially for drilling operations with pecking or rigid tapping.
🛑 Common Mistakes
| Mistake | Problem | Solution |
|---|---|---|
| Using G99 when clamps are present | Tool hits clamp or fixture | Use G98 until above obstacles |
| No retract specified | Controller may default unsafely | Always specify G98 or G99 |
| Wrong R-level | Tool retracts into the part | Check your R2 clearance value |
📌 Summary Table
| G-Code | Action | Best Used When |
|---|---|---|
| G98 | Retract to initial Z (safe) | Obstructed or fixture-heavy areas |
| G99 | Retract to R level (fast) | Clean, flat parts or production |
🔚 Final Thoughts
Understanding the difference between G98 and G99 can be the difference between a smooth operation and a broken tool or crashed machine. Always visualize toolpath movement, and simulate if possible.
G99 saves time — G98 saves tools. Use both wisely.
Leave a comment