From G54, G52, and G92 G-Codes [Work Offsets for CNC Fixtures]
G10 to Set Work Offsets in G-Code
G10 is a handy g-code that lets you program the G54 style work offsets from within your cnc program. The typical syntax would be:
G10 L2 Poo Xxx Yyy Zzz
Where âooâ is the work offset number, âxxâ is the X axis offset, âyyâ is the Y axis offset, and âzzâ is the Z axis offset.
For full details on how to use G10, see the special chapter of our G-Code Course.
Tip:
If you have an older control that doesnât have very many offsets, you can use G10 to reuse the available offsets with different coordinates.
Work Offsets and Macro Variables
On CNC machines that allow parameterized programming, there are usually also macro variables that correspond to each coordinate of each work offset. On a Fanuc CNC control, for example, the following variables are used for G54:
#5221 G54 X Axis Offset
#5222 G54 Y Axis Offset
#5223 G54 Z Axis Offset
#5224 G54 Fourth Axis Offset
You can access these variables to see what the values are or to change them.
Stop Using Work Offsets Entirely With G53 G Code
To stop using the offsets, use G53. This forces the machine to use the machine zero coordinates with no offset whatsoever as part zero. This is not done very commonly, but it is possible to do so.
Work Offset Alternative: Relative Coordinates
Another way to avoid using a work offset is to use relative coordinates. The idea is to position the operation in absolute coordinates then switch to relative coordinates in the code that wouldâve used an offset. You can learn more about relative coordinates in our chapter on g90 g code and g91 g code.
And from G10 G-Code: Quick & Automatic Tool and Work Offsets in G-Code
G10 G-Code: Quick & Automatic Tool and Work Offsets in G-Code the Easy Way
CNCCookbookâs G-Code Tutorial
Why Program Tool and Work Offsets with G10 G-Codes?
Itâs simple: G10 g-codes eliminate data entry errors and save setup time.
Suppose you have a fixture plate on the machine. It allows you to install fixtures at repeatable known locations. But, you need to set that up by making sure the work offsets are properly set for the particular fixtures youâre using. Typically, this requires the operator to set up the work offsets. But what if that could be automated and made a part of the cnc program?
In that case, the operator mounts the fixture on the fixture plate, loads the correct CNC Program, and presses the Green button. The first thing the CNC program does is setup the work offsets for the fixture it expects. If you want to be extra robust and idiotproof, perhaps the next thing it does is verify the correct fixture is in place. It could do this by asking the operator to verify fixture #<Serial number thatâs on the fixture> is there or we can even automate that step by probing for expected features.
Pretty slick, right?
Using G10 to set up Tool and Work Offsets can be a real power tool in your g-code programming arsenal, because it lets you automate things the operator would normally have to take care of manually each time at the CNC Machineâs control panel.
G10 is all about automating manual operationsâŚ
You know the drill when youâre setting up the machine for a job:
â Enter the proper tool offsets in the tool table for any new tools youâve added to the tool changer (or will be loading manually to run the job).
â Enter the proper work offsets that your part program expects to find. For a big fixture plate that holds 8 parts, this means going through 8 sets of coordinates by hand and making sure theyâre right.
With G10, you can set up either one of those things completely automatically using G-Code.
Setting Up Tool Data from a Tool Presetter and G10 G-Codes
Suppose youâve got a Tool Presetter. Hereâs a typical unit:
A Tool PresetterâŚ
You put the tool in your toolholder, drop the tool holder into the presetter, and measure the tool height and diameter using the presetter. A really nice presetter will then let you push a button and it will output a simple G-Code program that uses G10âs to transfer the values to your CNC Machineâs tool table so you donât risk making a data entry error doing it manually.
But, you could also write G10âs yourself in a little code snippet to set or change Tool Offsets if you needed to.
G10 G-Code Work Offsets Example: A Big Fixture Plate
If you donât have a presetter, or if you use a tool touchsetter to set tool offsets automatically right on the machine, you probably wonât get into G10 much for tool offsets. But work offsets are another matter. This can come up all the time.
Letâs say youâve invested in modular fixturing for your machine. Youâve got a fixture plate sitting on the machine table:
Fixture plate provides repeatability when installing the vises on the machine. Image courtesy of NYCCNC.com.
For example, a Fixture Plate can provide repeatability when installing the vises on the machine. Now if you can ensure those vises wind up in exactly the same place within relatively tight tolerances, why bother indicating part zero and setting up a work offset for each one? The whole point of the modular fixturing is to save you time doing things like that.
What you can do is measure those positions once for a particular location on the plate, and then put that data into a little g-code program that uses G10âs to set up the work offsets on the machine any time you want to use the vises in that configuration.
The savings are even greater when you have a big fixture plate that holds a lot of parts. And, aside from saving time, youâll be saving errors. Youâre automating away the problem of making a data entry error of some sort.
So letâs take a closer work at the syntax for using G10 so you can see how it worksâŚ