In CNC programming, a positioning mode refers to the way the CNC machine will read and understand every new XYZ location it is given.
For CNC machines, there are two positioning modes available.
The two modes are absolute positioning and incremental positioning.
Absolute mode is set using the G90 code and incremental mode is set using the G91 code.
Want to learn more about CNC G Code?
G90 [Absolute Positioning]
Absolute positioning is the mode that most of your CNC programs will be written in.
The alternative is incremental mode, and it is usually reserved for specific sections of a CNC program such as repetitive features.
The G90 code sets the machine into absolute positioning mode.
When G90 is active all locations will be given relative to a fixed point called the origin.
When we discuss coordinates, we list them in the order XYZ. If you see (1,2,3), then X=1, Y=2, and Z=3. Sometimes this is simplified to only show the X and Y coordinates such as (4,5). In this example, X=4 and Y=5.
Now that you understand coordinate locations, let’s talk about the origin again.
The origin is the (0,0,0) location. This means X, Y & Z all equal zero at this one point.
In absolute positioning mode the origin (sometimes called the zero location) is a fixed point.
This means it doesn’t move.
Using absolute positioning, you will set a location in your CNC machine as the origin and all locations in your CNC program will be given from that origin.
Each new machine location is given in parentheses () below. Notice how all locations are relative to the initial (0,0) location.
Advantages and disadvantages of absolute positioning
- Easier to track the location of your cutting tool throughout the program
- Changing one location doesn’t affect all of the following locations in the program
- Code can be hard to read for repetitive tasks such as drilling a large number of holes
G91 [Incremental Positioning]
While absolute positioning with G90 has a fixed origin or zero location, incremental positioning with G91 has a zero location that changes with each move.
Every time the cutting tool moves to a new location, that location becomes the new zero point.
Compare the picture below to the absolute positioning pic:
The numbers in parentheses () are the coordinates that the machine would be given to move to each new location in the two different positioning modes.
If at any time in the program we gave the machine a (0,0) coordinate in absolute positioning, the machine would return to the origin in the lower left corner.
If we did the same in incremental mode, the machine wouldn’t move.
In incremental mode the origin changes each move and a (0,0) would tell the machine to move zero units in both directions.
Giving the CNC a (0,0) location in incremental mode would tell it to stay put.
Advantages and disadvantages of incremental positioning
- Easier to read code for repetitive features and patterns
- Can reuse incremental sections of code easily either in the same program or as a subprogram
- Each location affects every location after it so changing one requires changing all others after it
Where you will find G90 and G91 in a CNC program
Setting the correct positioning mode is an important part of any CNC program.
For this reason, the positioning mode is often set in the safety lines of the program.
Safety lines are a line or lines of code that show up at the beginning of the program and at specific locations in the program. They are used to make sure the machine is prepared to run the next section of code.
They get used at the beginning of the program to set all the necessary modes before starting machining.
Safety lines often show up again when a tool is changed or a new machining operation is being performed.
Check out the “sections” of a small CNC program below:
- Program start
- Machine exterior profile of piece
- Drill pattern of holes
- Add counterbores to holes
- Program end
At the start of each of these sections you can expect to find safety lines that set the necessary modes needed for the upcoming operation. Doing this allows individual sections of the program to be re-run if needed.
Imagine you ended the program in incremental mode after using the counterboring canned cycle. Then you measure your part and realize the length and width are oversize.
So you decide to adjust your offsets and re-run the exterior profile section of the program.
If you don’t have safety lines that make sure the machine is set to absolute positioning mode, then the machine will remain in incremental mode and interpret the code very differently.
Setting your positioning mode is very important. Even if it doesn’t change often in the program, the codes get used frequently to make sure all the correct modes are set.
Which positioning mode is better?
Neither positioning mode is better, but they do have their own uses.
The body of most CNC programs will be written in absolute positioning mode.
This is because it is easier to understand and visualize where the cutter is.
In absolute mode you only need to know where the origin and the new location are to understand your position in the machine.
In incremental mode you need to know every move the machine has made to know what position you are at. That can mean a lot of calculations to figure out where you are located.
This might make it seem like absolute positioning mode is the best and should be used for everything, but that is not always the case.
Incremental mode is great for patterns and features that repeat.
This means incremental mode is often used when working with canned cycles.
Which codes will be affected by your choice of positioning mode?
Any code that uses XYZ movement as part of the code will be affected by your positioning mode.
All movement codes are affected by your choice of positioning mode:
- G00 [rapid travel]
- G01 [straight line movement]
- G02 [circular movement clockwise]
- G03 [circular movement counterclockwise]
Canned cycles are another set of commonly used codes that will be affected. They vary from machine to machine but generally canned cycles are the G73-G89 codes.
Another important code that is affected by your positioning mode is G28. The G28 zero return command can behave very differently from one mode to the other, so make sure you know how your machine will react before using it.
This isn’t a complete list of codes.
There are many more that are affected by your choice of positioning mode, but this is a good start for anyone new to CNC machining.
As always, know your machine and check the manual if available to fully understand how it will react to any code you give it.
Frequently asked questions about CNC positioning modes
What happens if you don’t select a positioning mode?
On most CNC machines, there is a default positioning mode.
If you don’t use the G90 or G91 command, the machine will stay in the default mode.
The default mode is most often set to incremental mode for safety reasons.
It is not recommended to rely on the default modes of your machine to make sure you are in the correct positioning mode.
You should always set the positioning mode you need with either a G90 or G91 code.
Can you use the G90 and G91 codes on the same line/block?
No, it is not possible to use the G90 and G91 commands on the same line.
Both G90 and G91 are modal commands from the same group. This means turning one on turns the other off.
With G90 and G91, only one code can be active at a time.
What could happen if you use the wrong positioning mode?
To put it simply, your machine could crash.
Moving to the (0,0) location in absolute mode with G90 will bring you to the part zero location. This could be any location you chose on your workpiece.
Moving to the (0,0) location in incremental mode with G91 will not move your machine at all.
These are two very different commands being executed based on the positioning mode.
Forgetting to set the correct positioning mode can cause the CNC machine to act in very unexpected ways for the programmer. Unexpected is never good when it comes to CNC machining.
Because being in the correct positioning mode is so important, the positioning mode is often set in the safety lines of the program.
Safety lines are used to make sure the machine is in all of the correct modes before running a section of the CNC program.