There are two main functions for the R code when CNC programming, radius size and setting the retract (R) plane.
When combined with the G02 or G03 circular interpolation commands, the R code specifies the size of the radius to be machined.
When combined with canned cycles such as G73 through G89, the R code specifies the location of the R plane or clearance height to be used.
Want to learn more about CNC G Code?
Radius size with G02 or G03
There are two types of circular movement (interpolation) that can be used when CNC machining.
They are G02 for clockwise movement and G03 for counterclockwise movement.
The format for using both codes is:
G02 (or G03) X10 Y15 R5 F30
The X and Y locations are the end point of the circular movement.
The R value is the radius size of the circle and F is the feedrate.
Circular movement can also be performed using IJK codes instead of XY locations and an R value.
Both methods are common, so be on the lookout for either type.
R plane with canned cycles
The R plane is a specific height that the CNC will reference when performing a canned cycle.
First it is the height that the machine will rapid travel to and begin the machining part of the canned cycle.
It is also the height that the machine will return to if the G99 [return to R plane] command is active.
If the G99 [return to initial plane] command is active then the machine will return to the start of the canned cycle instead.
The G98 and G99 codes are used to switch between the two types of clearance modes available when running canned cycles.
The G98 code moves the cutter further up and away because in most instances the canned cycle is started at a higher Z height location further away from the part. This increases the time that it takes the machine to run the program.
The G99 command is used to keep the machine closer to the part being machined. It should only be used when you are sure that there are no obstacles in the way such as the part itself, clamps or fixtures.
Format for using the R code with canned cycles
The format for using canned cycles is:
G81 X0 Y0 R5 Z1 F5 G98
G81 is the canned cycle. This can be replaced with any other canned cycle as needed.
The R code sets the retract plane height.
The X, Y and F codes are not required.
X and Y are the location where the canned cycle will be run. F is the feedrate of the cutter.
Often, the X and Y codes will be placed on the previous line.
It is good practice to include the feedrate (F) code.