G Codes are also called as Geometric Codes. It deals with the preparatory function of the CNC machine.
It is a code telling the machine tool what type of action to perform, such as:
- Rapid movements
- Controlled feed movement .
- Series of controlled feed moves
- Set tool information such as offset
- Switch coordinate systems
The G Codes are classified into two types.
- One shot G Code
- Modal G Code
One–shot G code – The G code is effective only in the block in which it is specified.
Example: G04 Dwell
When the dwell is commanded as G04 X2.0; It means dwell for two seconds. The G code once executed will become inactive when the next block is read.
Modal G code – The G code is effective until another G code of the same group is specified.
Example: G01- Linear Interpolation
When linear interpolation is commanded as G01 X10.0 Y12.0; It means a linear interpolation movement to X10.0 and Y12.0 position. The G code will be active even after being executed for the next block until another G code of the same group is commanded.
G01 X10.0 Y12.0;
X20.0 Y25.0;
G00 X100.0 Y220.0;
In the first blocks the G01 is active even though it is not commanded in the second block. But in the third block as G00 which is of the same group of G01 the G01 is inactive and G00 active.
The G Codes that are used in CNC machines are
G – Code | Function | Format |
G00 | Positioning rapid traverse | G0 X Y Z ; |
G01 | Linear interpolation (feed) | G01 X Y Z F ; |
G02 | Circular Interpolation Clockwise | G02 X Y I J F ; or G02 X Y R F ; |
G03 | Circular Interpolation counter clockwise | G03 X Y I J F ; or G03 X Y R F ; |
G04 | Dwell | G04 X1.0 ; ( one seconds)
G04 P1000 ; ( thousand milli seconds) |
G10 | Data setting | Syntax for Setting and changing work offset
G10 G90 L2 P1 X145.251 Y-55.124 Z-485.241; L2 = Load work offset P = 0 External work zero offset (G53) P = 1 to 6 work coordinate system (G54 – G59) Setting and changing the tool length offset value Syntax for assigning Tool length compensation value (H code) G10 G90 L10 P1 R100.0 ; L10 = Load Tool length P = Offset number R = Tool offset value Syntax for assigning Tool length wear compensation value (H code) G10 G90 L11 P1 R-0.02 ; L11 = Load Tool length wear Changing cutter radius offset value Cutter radius compensation value ( D code) G10 G90 L12P1R10.0 ; L12 = Load radius compensation Cutter radius wear compensation value ( D code) G10 G90 L13P1R-0.03 ; L13 = Load radius wear compensation |
G17 | X Y plane | Must be commanded in the beginning of the program or wherever changes required |
G18 | Z X plane | |
G19 | Y Z plane | |
G20 | Input in inches | |
G21 | Input in millimeters | |
G28 | Automatic zero return | G28G91X0.0Y0.0Z0.0; |
G30 | 2nd reference point return | G30G91X0.0Y0.0Z0.0; |
G40 | Cutter radius compensation cancel | G40 X Y ; |
G41 | Cutter radius compensation left | G41 X Y D ;
G42 X Y D ; G41 or G42 must be used with G0 or G01 |
G42 | Cutter radius compensation right | |
G43 | Tool length compensation | G43 Z H ;
G43 must be used after each tool change when moving the Z axis for the first time |
G49 | Tool length compensation cancel | Used before every tool change |
G53 | External work offset | |
G54 to G59 | Work coordinate system 1 to 6 | G0G90G54X25.0Y25.0; |
G73 | Peck drilling | G73 R Z Q F
X Y G80 |
G84 | Rigid tapping cycle | M29 S
G84 R Z F P X Y G80 M28 |
G90 | Absolute command | |
G91 | Incremental command |
The above list are the G Codes that are used in the Machining centers. Similarly we have a list of G Codes for the turning center.
The G Codes are mostly common in all the machining centers however there will be some changes in Turning Center based on the G Code System Setting which is applicable only in a Turning Center.
We Hope you would have got some idea about G Codes and the application of the same. Please leave your comments and suggestions in the comment section to help us improve better.