Do you want to be a better CNC'er in 37 Seconds? Get Better Tool Life, Surface Finish, and Material Removal Rates Fast. It's that easy. You can install and get results now. |
![]() |
Relative vs Absolute Coordinates |
What are Relative vs Absolute Coordinates?
Let’s start with a definition. Absolute coordinates are measured from program zero, the program’s origin. Relative moves are measured from the current position. We just looked at Circular Arc moves using G02 and G03. The coordinates of the arc center as expressed by I and J are relative coordinates.
Now, a more practical example. Suppose you're in a grocery store and you ask the clerk which aisle the cookies are on. If he responds, "Go to Aisle 14 for the cookies," that's an absolute coordinate that is relative to the first aisle--the grocery store's "part zero". If instead he responds, "It's three aisles down that way," that's a relative coordinate. We're used to both kinds in everyday life and both are useful depending on the situation.
Note that what I'm calling "relative coordinates" are often called "incremental mode" coordinates in the CNC Controller Programming manuals. It's just another way of saying the same thing.
Switching between Relative and Absolute Coordinates
How can we switch between Relative and Absolute Coordinates? The usual way is to use G90 to use Absolute Coordinates and G91 to use Relative Coordinates. For example:
G90 ( Switch to absolute coordinates )
G0 X0Y0Z0 ( Move to program origin at 0, 0, 0 )
G91 ( Switch to relative coordinates )
G0 X1Y1 ( Move one unit right in X and one unit right in Y )
G90 ( Switch back to absolute coordinates )
The preceeding program includes both an absolute move to X0Y0Z0 and a relative move. As you can see, G90 and G91 are modal.
Which Mode Does My Controller Use as the Default?
Interestingly, most controls will startup in relative/incremental mode (G91). This is done because it is thought to be safer if the mode is not what you expect. In other words, if you expected absolute it is thought to be safer to start in incremental than if you expected incremental and start in absolute. The truth is, not being in the mode you expect is not safe any way you look at it because the machine will do something unexpected. Therefore, make sure one of the first things you do in your program is to set it to either G90 or G91 so it does what you expect!
Using UVW Words for Relative Coordinates
Some controllers allow both styles to be active at once using UVW. We could write the previous program this way:
G90 ( Switch to absolute coordinates )
G0 X0Y0Z0 ( Move to program origin at 0, 0, 0 )
G0 U1V1 ( Move one unit right in X and one unit right in Y )
This UVW format is convenient and a little shorter. We’ve already mentioned controllers where I and J are relative which is a similar case to UVW, albeit intended for arc center location.
Why Would I Use Relative vs Absolute Moves?
Let’s consider a couple of cases.
First, its all about how you want to think about your problem. Is it more natural to think about what's going on relative to some absolute central point or relative to your current location? The CNC controller doesn't care, so do what's easy for you.
Second, suppose you’re just reading off a print and keying in the g-code. It may be easier to use the relative coordinates for some points as you may not have an absolute coordinate readily available. Prints usually provide dimensions relative to adjacent features rather than relative to some absolute part zero origin.
A last example, is when writing subprograms. Suppose you have a feature that is repeated more than once in your g-code program. Perhaps you drill a hole, chamfer it, and then thread it with a tap, for example. These holes are located all over a plate you're machining. The easy way to program such a think is to create a subprogram (we'll be talking about subprograms in detail a little later, but for now, use your imagination) that assumes it is located above the center of the hole and can just proceed to do all the work using relative coordinates. Now you can just make an absolute move and then call the subprogram for each hole and only have to write the code once. What a time saver.
Exercises
1. Write a g-code program that feeds the cutter around a 1 inch by 1 inch rectangle whose center is at 1, 1. Use absolute coordinates.
2. Convert the program you wrote in #1 to use relative coordinates. You may use an absolute coordinate to get to the center of the rectangle in an initial G00 move.
3. Determine whether your control allows UVW moves, and if so, rewrite #2 to use them without calling G91 to switch to relative coordinates.
Try the Free Trial Version of G-Wizard G-Code Editor...
No credit card required--just your name and email.
Next Article: Polar Coordinates
Do you want to be a better CNC'er in 37 Seconds? Get Better Tool Life, Surface Finish, and Material Removal Rates Fast. It's that easy. You can install and get results now.
|
||||||||||||||||||
|