CNCCookbook’s G-Code Tutorial
G98 G-Code and G99 G-Code: Lathe or Mill?
The meaning of G98 and G99 g-codes can change depending on whether we’re on a lathe or mill. Not all g-code dialects behave this way, but Fanuc and Haas certainly do.
G98 and G99 on Mills: Retract depth after a canned cycle return
On a mill, G98 and G99 control the return point after a canned cycle. If G98 mode is set, it returns to the initial Z plane after the canned cycle. If G99 is set, it returns to the R-plane after the canned cycle.
This is very much a fine tuning parameter. Z is higher than R. Typically, it will be the “Safe Z” that CAM programs use so they can move at rapids speeds without running into anything. Be careful though, that all depends on how you post is set up or how you’ve written the program. All G98 guarantees is that it’ll return to the initial Z position things were at when the canned cycle began.
The R-Plane is something you will have specified when you began the canned cycle. Typically it is closer to the workpiece than the initial Z. Most CAM software will be set up to rapid from that Z to the R position and then to switch to the feedrate before going further.
G98 and G99 on Lathes: Feedrate Mode
On lathes, the behavior of G98 and G99 is completely different. It’s used to set the Feedrate Mode. Think of it as how feedrate will be specified.
G98 specifies feedrate per minute. G99 specifies feedrate per revolution.
So, with G98, if you write “F100” in the g-code, it gives a feedrate of 100 inches per minute. With G99, “F100” would be crazy fast–100 inches per revolution of the spindle. You’d be more likely to see “F0.004”, which is 4 thousands per revolution.
Why would you use G99?
Because it makes it a lot easier to deal with feedrates. G98 lets you enter the chipload of your tool as the feedrate. That’s pretty sweet because you can enter feedrates that are independent of the spindle rpms, which just saves you making calculations.
As such G98 and G99 go hand in hand with G96 CSS-style spindle speed setting.
Next Article: G04 GCode: Pause / Dwell for Precise Timing
Like what you read on CNCCookbook?
Join 100,000+ CNC'ers! Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, we’ll give you access to some great CNC reference materials including:
- Our Big List of over 200 CNC Tips and Techniques
- Our Free GCode Programming Basics Course
- And more!
Just enter your name and email address below:
100% Privacy: We will never Spam you!
Bob is responsible for the development and implementation of the popular G-Wizard CNC Software. Bob is also the founder of CNCCookbook, the largest CNC-related blog on the Internet.