Do you know how to switch between G98 and G99 canned cycle retract settings?
Fanuc controls provide modal G codes that control where the tool ends up following a cycle. The G98 code causes the tool to return to the initial level after each canned cycle operation; the G99 code causes the tool to return to the R-point level after each canned cycle operation.
NC programmers generally have a good idea of what sort of retract level is best used for a particular operation, but are often unsure about how to get the CAM system and post-processor to output the results they require.
The first step is to resist the urge to use INSERT or PREFUN to “force” the required G code out to tape (we’ll tell you why later).
The next step is to make sure that the post-processor understands that these G codes are available on the machine. You can do so in the CAM-POST QUEST Developer module by answering as follows in the CYCLE parameters tab of the Automated Canned Cycles / General
Drill Cycle Information section.
The final step is to tell CAM-POST GENER what retract level you would like during cycles. GENER provides a RETURN[,value] parameter (the value is optional) on the CYCLE post-processor command syntax, which specifies the return height relative to the cycle control point, in the same way that the cycle clearance and depth are specified using CLEAR,value and DEPTH,value parameters. The RETURN parameter affects the cycle as follows:
- RETURN not specified
A G99 code will be output if not already active, to return the tool to the R-point level after each canned cycle operation.
- RETURN specified without a value
A G98 code will be output if not already active, to return the tool to the initial level after each canned cycle operation. The initial level is the current position prior to calling the cycle. It should be at least as high as the R-point of the cycle.
- RETURN specified with a value
If the value is less than or equal to the R-point of the cycle, then a G99 code will be output if not already active, to retract to the R-point.
If the value is greater than the R-point of the cycle but does not correspond to the current height, then CAM-POST will temporarily cancel canned cycles if active (e.g., G80), then rapid position to the required retract clearance above the hole. A G98 code will then be output if not already active, to return the tool to the initial level after each canned cycle operation.
Getting the CAM system to output the RETURN parameter exactly as you want is not always easy. For that reason, CAM-POST provides a modal CYCLE/RETURN command that can be used to override the RETURN information present (or not) on subsequent CYCLE commands. The syntax is as follows:
- ON is equivalent to coding a RETURN parameter without a value on subsequent CYCLE commands. This results in a G98 return to initial height.
- OFF is equivalent to omitting the RETURN parameter on subsequent CYCLE commands. This results in a G99 return to R-point.
- A value can be specified, which is equivalent to coding “RETURN,value” on subsequent CYCLE commands, with corresponding output of either G98 or G99 as described earlier.
- Finally, AUTO cancels the modal CYCLE/RETURN setting, telling CAM-POST to once again use the RETURN parameter as specified (or not) on subsequent CYCLE commands.
Why not use INSERT or PREFUN?
Because using the RETURN parameter on a CYCLE command, or using the modal CYCLE/RETURN command, will work with any post-processor whether the machine supports G98/G99 retract codes, or a word address (e.g., K) that defines the retract position, or has a fixed retract format. This makes it easier to later post-process the same CAM program for a different CNC machine if necessary.