G02 and G03 CNC Code
G02 and G03 codes are CNC G codes and used to perform circular interpolation in CNC machines. It is used in CNC Turning and Machining Centers for the same purpose. G02 code is used for clockwise (CW) circular interpolation, and the G03 code is used to perform counterclockwise (CCW) circular interpolation.
G02 and G03 codes used to perform radius, arc and circular cuttings are modal codes and remain active until G00 or G01 code activated by CNC operator in CNC program. Therefore, when G02 and G03 codes are desired to be terminated, G01 command which is the linear interpolation command must be used in the system.
G02 and G03 codes, which are a circular interpolation command, is designed to make circular cutting in a workpiece and must be used together with the F__ (Feedrate) variable. If the F__ command is not written, the system will consider the last used F__ value in the program as valid feedrate. F__ variable given in the program before using the G02 or G03 command will be directly accepted by the machine and will change the feedrate of the G02 and G03.
Absolute and Incremental System
In CNC lathe machines; if U and W are used as axis names G02 and G03 will perform an incremental movement. If axis names are used as X and Z, the system will move absolute.
In CNC Machining Centers G91 code is used to specify incremental system/motion. Absolute system/motion is activated with the G90 code. In other words, these modes are selected with the help of separate G codes, not by changing the axis names like in CNC lathe.
The table below shows how to switch between absolute and incremental systems on CNC machines.
|CNC Lathe||CNC Milling|
|Command||G00, G01, G02, G03 etc.||G00, G01, G02, G03 etc.|
|Absolute system||X, Z, C etc.||G90|
|Incremental system||U, W etc.||G91|
|Absolute system example||G02 X10. Z10. ;||G90 G02 X10. Z10. ;|
|Incremental system example||G02 U10. W10. ;||G91 G02 X10. Z10. ;|
When the absolute system is selected, the exact position (coordinate) the tool will go to on the machine is specified. While in the incremental system, how far the tool will travel from its current location is specified.
G02 and G03 Code Format
G02 Code for CNC Lathe
|G02 X(u) Z(w) R_ F_ :|
G02 code is used to perform clockwise (CW) circular interpolation in CNC lathe. The direction of the movement and toolpath can be seen above.
G03 Code for CNC Lathe
|G03 X(u) Z(w) R_ F_ :|
G03 code is used to perform counter clockwise (CCW) circular interpolation in CNC lathe. The direction of the movement and toolpath can be seen above.
G02 Code for CNC Milling
|G17 G02 X_ Y_ R_ F_ ;|
G18 G02 X_ Z_ R_ F_ ;
G19 G02 Y_ Z_ R_ F_ ;
G02 code is used to perform clockwise (CW) circular interpolation in CNC milling machines. Since there are three axes in CNC milling machines, it is necessary to specify in program which two axes you want to perform circular interpolation. Therefore, it is necessary to use one of the plane selection commands G17, G18 or G19. If you do not specify the coordinate plane with the command, the system accept last selected plane. If it is never selected in program before also, the plane which is specified by parameter settings (usually X and Y, ie G17) will be valid.
G03 Code for CNC Milling
|G17 G03 X_ Y_ R_ F_ ;|
G18 G03 X_ Z_ R_ F_ ;
G19 G03 Y_ Z_ R_ F_ ;
G03 code is used to perform counter clockwise (CCW) circular interpolation in CNC milling machines. The plane selection situation is same with G02 which is explained above.
Plane Selection and I,J,K Parameters
G02 and G03 codes are used to perform circular interpolation in 2 axes as standard. Since there are two axes in a machine with 2 axes in total (for example simple CNC lathe), the system will perform circular interpolation in these two axes with the G02 or G03 command. However, if we are writing a program on a machine with more than two axes (like CNC milling machines), – in this case, it is necessary to specify in program which two axes you want to perform circular interpolation. The table below shows which G codes activate which planes and which two axes.
I, J and K Parameters
R parameter or one of I, J, K parameters can be used with G02 and G03 codes. The R parameter specifies the radius amount directly to the system, while the I, J and K parameters are used to specify the radius center. Therefore, they are different methods to do the same process, but all modern controllers support the R parameter. I, J and K parameters are used in older generation controls. Therefore, it is unnecessary to calculate the radius center using I, J or K and write program step by step for the radius movement. Therefore it is easier and more efficient to use the R parameter.
The table below shows the which one used for which axis and also whether it is positive or negative with respect to the direction I, J, and K. (K not shown in image)
|I : Arc center vector I is the distance, with specified direction, measured from the start point of the arc, to the center of the arc, parallel to the X-axis.|
|J : Arc center vector J is the distance, with specified direction, measured from the start point of the arc, to the center of the arc, parallel to the Y-axis.|
|K : Arc center vector K is the distance, with specified direction, measured from the start point of the arc, to the center of the arc, parallel to the Z-axis.|
Note: I, J and K parameters are shared for information purposes only. The R parameter is easier to use and is available in all modern controllers.
G02 and G03 Code Examples
G02 and G03 Code Example for CNC Lathe
|N10 G50 S2000;|
G96 S200 M03;
G42 G00 X35.0 Z5.0 T0303 M08;
G01 Z-20.0 F0.2;
G02 X67.0 Z-36.0 R16.0; (G02 X67.0 Z-36.0 I16.0 K0)
G03 X100.0 Z-52.0 R16.0; (G02 X100.0 Z-52.0 I0 K-16.0)
G40 G00 X200.0 Z200.0 M09;
G02 Code Example for CNC Milling
N20 G54 G90;
N25 T01 M6;
N30 S1500 M03;
N35 G94 F800;
N45 G00 X30 Y0 Z10;
N50 G43 G00 Z–5 H1;
N55 G01 X90;
N60 G02 X120 Y30 I30 J0;
N65 G01 Y70;
N70 G02 X90 Y100 I0 J30;
N75 G01 X30;
N80 G02 X0 70 R30;
N85 G01 Y30;
N90 G02 X30 Y0 R30;
N95 G00 Z200;
N100 M05 M09;
|“Click here to see all examples for G02 and G03 codes”|