Quick G-Code Arc Tutorial:
Make G02 & G03 Easy, Avoid Mistakes
CNCCookbook's G-Code Tutorial
Circular Interpolation is Motion Along a Circular Arc
Having just finished discussing linear interpolation, or motion in a straight line, we next come to circular interpolation, which is motion along a circular arc. Other than the fairly exotic ability to follow a "NURBS" path, most g-code controllers only support two kinds of motion: linear and circular. Circular interpolation is quite a bit more demanding on your machine as two axes have to be precisely coordinated. Drawing a complete circle involves not just coordinated motion but reversal of direction at each of the 4 quadrant points. These would be the points corresponding to 0, 90, 180, and 270 degrees. If the machine has any backlash at all, it will be obvious at these reversals because there will be a glitch in the cut there.
Circular Motion is a Mode Initiated Via G02 and G03
Like linear motion (initiated by G00 and G01), circular motion is a mode initiated via G02 or G03. G02 establishes a mode for clockwise circular arcs. G03 establishes a mode for counter-clockwise circular arcs.
Defining An Arc For the CNC Controller
Once either the G02 or G03 mode is established, arcs are defined in G-Code by identifying their 2 endpoints and the center which must be equi-distant from each endpoint or an alarm will occur. The endpoints are easy. The current control point, or location when the block is begun establishes one endpoint. The other may be established by XYZ coordinates. The center is a bit more complex.
Defining the Center Via IJK Relative Offsets
The center is most commonly identified by using I, J, or K to establish relative offsets from the starting point of the arc to the center. Here is a typical clockwise arc:
Defining an arc's center with IJK...
This arc starts at X0Y2 and finishes at X2Y0. It's center is at X0Y0. We could specify it in g-code like this:
G02 (Set up the clockwise arc mode)
The I and the J specify relative coordinates from the start point to the center. In other words, if we add the I value to the starting point's X, and the J value to the starting point's Y, we get the X and Y for the center.
Defining the Center Via the Radius Using "R"
We can also define the center just by specifying the radius of the circle. In this case, our circle has a radius of 2, so the g-code might be simply:
Many of you will be deciding right here and now that since R is easier to understand and shorter to write, you're just going to use R and forget about IJK. But, the CNC teachers in the world will suggest that you should prefer IJK. Their argument is that when you use IJK, you get a double check that your arc is correct.
Because the controller gets to compute an actual set of coordinates for the center via IJK. Once it has the center's coordinates, it can check that it is equa-distant from both end points. The check of each of those two distances is the double check. In the case of the "R" format, the controller has no such double check. It has to chose a center that guarantees equal distance.
Personally, I don't know if I agree with the CNC instructors that this is providing any extra checking or not. I say go with whichever approach makes sense for your particular situation, but you should definitely be familiar and comfortable with both. You're going to need to be comfortable with relative coordinates anyway, as they're darned handy. May as well get comfortable now.
It's kind of like being told you should only use the 4-jaw chuck on a lathe when you first start out so you'll get very comfortable dialing it in. It's a good skill to be good at as a machinist!
In Part 2, we'll cover:
- Variations in Arc Syntax for Different Controls and Modes
- A tip to make arc programming much easier
- How to set up GWizard Editor for Arcs
- The Most Common Problem with Arcs for CAM and GCode Simulators
And more! So, keep going to Part2...
Next Article: GCode Arcs: Part 2
Try the Free Trial Version of G-Wizard G-Code Editor...
No credit card required--just your name and email.