Welcome to our comprehensive guide to using the G02 CNC code. Whether you’re a beginner learning CNC programming or an experienced machinist, understanding the G02 CNC code is extremely important.
In this guide, we’ll break down everything you need to know about this circular interpolation command, including how, when, and why to use it.
What does a G02 code do?
G02 sets the CNC movement mode to clockwise circular movement, otherwise known as circular interpolation.
G02 is a modal command which means it will stay on until switched to another code in the same movement group of codes such as G00 – Rapid travel, G01 – Linear interpolation or G03 – Counterclockwise circular interpolation.
Learn CNC Programming – It’s Easier Than You Think!
Learning G Code doesn’t have to be difficult…
If you know what to focus on.
Join our simple, easy-to-follow course, “G Code Made Easy: CNC Programming for Beginners“. We walk you through all the important codes – with simple explanations and real-world examples.
Want to become a super-skilled CNC programmer? Join now to take the shortcut to becoming a G Code Master today!Make Learning G Code Easy
What is circular interpolation?
You know how when you zoom in real far on a photo, it starts to look all pixelated?
Circular interpolation is kind of like that. When we zoom in real close and look at how the machine is moving, we see it isn’t so smooth.
While it may look like your CNC machine is moving in a perfect circle, it is actually moving in a series of small steps that look like a circle. This is called interpolation.
Basically, your CNC is doing the best it can to mimic a perfect circle.
You don’t need to do anything differently, it’s just good to know what we mean by interpolation.
G02 [clockwise circular interpolation] vs G03 [counterclockwise circular interpolation]
Everything that applies to the G02 code applies to the G03 code as well.
The only difference between the two is the direction of movement.
G02 moves clockwise and G03 moves counterclockwise.
G02 vs G2
Some people get confused about whether the 0 is required to be included in a G02 code.
To clear this up, there is no need to include the extra zero in the code. The CNC machine will read the code the same. It really is just a matter of preference.
Often you will see the full G02 code used in textbooks or other reference materials. In practice though, many prefer the shortened G2 code in their programs.
If you are working on your own, then go with whichever format you prefer. If you work in a bigger shop, make sure to stick to the format that the business has been using.
When to use a G02 code?
G02 codes will usually be in the lines of the program that are used to cut the part.
The G02 code allows the programmer to cut a full circle or portion of a circle.
An R code is used as well to tell the machine what size radius to move along. Some CNC programs will use IJK codes instead of an R code to describe the circular move.
Other codes used with G02
The codes below are used with the G02 code or commonly found very close to a G02 command in a CNC program:
- M03 – Spindle on, clockwise
- M05 – Spindle stop
- M08 – Flood coolant on
- M09 – Coolant off
- N – Program line number
- R – Radius size
- S – Set spindle speed
- X – X axis location of the hole
- Y – Y axis location of the hole
- Z – Z axis location of the bottom of the hole
Format for using a G02 code
G02 X7.5 Y1.5 R0.5
Once the G02 code is used the machine will move to any XYZ locations given in a circular movement going clockwise along the given radius size and at the set feed rate.
Because G02 is a modal code, you don’t need to specify it on every line of code.
If the next line of code after the one above was:
X7.0 Y1.0 R0.5
then the machine would still move to the location in a circle at the set feed rate. Because it’s modal it stays on until switched to another mode.
The feed rate will also remain the same until it is changed and isn’t required to be on every line. This means that the feed rate can be set before the G02 code is used as well.
How to turn off the G02 code
There isn’t a specific cancel command for G02 like there is for canned cycles. Instead to turn G02 off you will need to switch it to another code in the same group of movement codes.
The other codes in the movement group are:
Using any of these codes will turn G02 clockwise circular interpolation off and switch to the new movement mode.
What to think about when using a G02 code?
First, make sure you know what units you are working in.
Absolute vs incremental mode
The second thing to know is how the machine will understand position locations.
Absolute positioning will move from a set zero location such as your machines home location or a specified location on your part.
Incremental positioning will move relative to your current position.
The images below show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.
Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location.
In incremental mode, all locations are relative to the machine’s current location.
Start and stop locations
Lastly, make sure you understand the path that the tool will take from it’s start location to the new location.
Check where you are currently position wise (X, Y & Z location), where you will be moving to and if there is anything in between the two locations.
The G02 code will move the machine in a circular arc to your new location. You don’t want anything in the way or to miscalculate your stop point. Clamps or vises can be easy to forget about and run into.
Crashing your machine is never a good time.
CNC codes that are similar to G02
Note that all the movement codes listed below are modal.
This means they will stay in the movement mode identified by the code until switched to a different mode.
Ready to master CNC programming?
Join our simple, easy-to-follow course, ‘G Code Made Easy: CNC Programming for Beginners’ and take the shortcut to becoming a G Code Master today!Master G Code Today