We use technical and security cookies and, only if you accept, analytics with no cross-site tracking. More in the Cookie policy and Privacy policy.
We use first-party cookies and technical storage to make the site work, Google reCAPTCHA security technology and, only if you accept, Vercel analytics (no cookies, no cross-site tracking). You can accept or reject analytics; both options are equivalent and you can change your choice at any time. More info: Cookie policy, Privacy policy, Legal notice and Terms and conditions.
G10: writing work offsets and tool offsets from the program
G10
G10 writes data into the machine tables from the program itself: work offsets, length offsets and radius offsets. Instead of the operator typing the value into the screen, the program writes it, and it is stored exactly as if it had been typed. The L word says which table the data goes to, P says which row, and X, Y, Z or R carry the value. It is a powerful tool and therefore a delicate one: what it writes stays in the machine after the program ends.
For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.
Family
Offsets
Machine
Milling, Turning, Mill-turn
Risk
High
Example
G10 L2 P1 X0 Y0 Z0
Syntax by control
Fanuc (work offsets)
G90G10L2P1X-412.350Y-215.780Z0.
P1 is G54, P2 is G55 and so on to P6 = G59; P0 writes the common shift. Under G90 the value replaces what was in the table and under G91 it is added to what is there, which is the most important difference in the whole code. For the extended work offsets you use L20 with P1 upward.
Fanuc (tool offsets)
G10L10P4R125.360
L10 writes the length geometry of offset 4 and L11 its wear; L12 and L13 do the same with the radius. The L numbering has changed between control generations and between builders, so check it in the manual before you run the program.
Haas
G10L2P1X-412.350Y-215.780Z0.
Haas takes the same families for work offsets and tool offsets, and how P maps onto the extended work offsets (G154 P) varies with the model and the control version: look it up before using it. As on Fanuc, G90 and G91 decide whether the value replaces or adds.
Fanuc (turning)
G10P3X-52.140Z-128.360R0.4Q3
On a lathe, the same code writes the tool offset: R is the nose radius of the insert and Q its tip orientation code (0 to 9). Without the right Q, tool nose radius compensation is applied to the wrong side on tapers and radii.
Siemens 840D / 828D
$P_UIFR[1,X,TR]=-412.35
Siemens does not use G10: work offsets are written into system variables such as $P_UIFR and tool data into $TC_DP. The effect is the same, the program modifies a permanent machine table, and so are the precautions.
Heidenhain TNC (Klartext)
FN26:TABOPEN/FN27:TABWRITE
On the TNCs, writing to tables is done with the FN 26 and FN 27 functions, or straight from the probing cycles, which store the result of the measurement in the preset table or the tool table without you writing the value at all.
Address letters used with it
Letter
What it sets
Unit
L
Which table is written: L2 the G54-G59 work offsets, L20 the extended ones, L10 and L11 the tool length (geometry and wear), L12 and L13 the radius (geometry and wear). The numbers vary between controls.
integer
P
Which row: the work offset number (P1 = G54 ... P6 = G59, and P0 the common shift) or the tool offset number.
integer
X Y Z
Values written into the work offset. Under G90 they replace the ones in the table; under G91 they are added to what is already there.
mm / in
R
Value of the tool offset: the length or the radius, depending on the L that goes with the block.
mm / in
Q
On a lathe, the tip orientation code of the insert (0 to 9) when writing an offset.
integer
Worked example
A two station fixture on a milling machine, the stations exactly 250 mm apart in X by construction. Instead of picking up both, the program writes the work offset of the first one and calculates the second, and while it is at it applies a wear correction measured on the previous run. This is the typical use of G10 in a shop that repeats the same job every week.
O0110(ORIGENES Y CORRECTOR ESCRITOS CON G10)
( Program header. )
G21G17G40G49G80
( Clean starting state, before anything is written into the tables. )
G90G10L2P1X-412.350Y-215.780Z0.
( Writes the G54 work offset (P1): the distance from machine zero to the corner picked up on the first station. With G90, the value replaces whatever was in the table. )
G90G10L2P2X-162.350Y-215.780Z0.
( Writes the G55 (P2): the second station sits 250 mm to the right by construction of the fixture, so only the X changes. Pick one up and you get the other without measuring again. )
G91G10L11P3R-0.030
( Adds three hundredths negative to the length wear of offset 3: the previous run was coming out deep. Under G91 the value is added to what was there; under G90 it would replace it and the earlier adjustment would be lost. )
G90
( Straight back to absolute. G91 is modal and would affect the following blocks, other G10 blocks included. )
G91G28Z0.
( Z to the reference point before the change. )
T1M06
( 8 mm cutter. )
G90G54G00X0.Y0.
( First station, with the work offset the program has just written itself. )
G43H01Z50.M03S3000
( T1 length offset and spindle on. )
M98P1100
( Subprogram with the machining of the part. )
G55G00X0.Y0.
( Second station: changing work offset is enough, because the subprogram coordinates are relative to each part's zero. )
For four things that come up again and again. Fixtures with known positions, where you pick one station up and calculate the rest instead of measuring them. Production runs, where the program applies the wear correction measured on the previous part with nobody typing anything. Repeat jobs, with a setup program that leaves the machine exactly as it was last time. And probing routines and macros, which store the result of the measurement straight into the table. In every case the advantage is the same: taking manual typing out of the loop, because that is where the errors creep in.
G90 and G91 with G10: replace or add
This is the most important distinction in this code. Under G90, the value written replaces what was in the table; under G91, it is added to what is there. Adding is what you want when applying a wear correction measured on the part, because it respects the adjustment already in place. Replacing is what you want when setting a work offset, because the value is absolute. Confusing the two in a program that runs twenty times a day is one of the most expensive errors there is, because every run shifts the work offset a bit further and no alarm goes off until the part is out of print.
What to keep in mind before you use it
G10 modifies permanent machine data, so there is no harmless simulation: a dry run writes into the tables as well. The L and P numbering is not the same on every control or every generation, so a program with G10 does not get copied from one machine to another without review, still less the work offset values, which are distances to the zero of that particular machine. The healthy habit is to group the G10 blocks at the start of the program, commented, with the G90 or G91 written explicitly in the same block.
Mistakes that cost you a part (or a tool)
Running a G10 L2 with a G91 inherited from an earlier block: the work offset is added to on every run and the part walks away without anyone noticing.
Getting the P number wrong: you wipe out the work offset of another station that was set up properly, and there is no way to get it back other than picking it up again.
Testing the program dry believing nothing happens: G10 writes into the table even when the axes are not cutting.
Copying a program with G10 from another machine: the work offset values are distances to the zero of the machine they were measured on.
Using Fanuc L numbering on a control of another brand or another generation without checking it in the manual.
Writing the length into the wear offset (L11) instead of the geometry one (L10): the operator's fine adjustment is lost and nobody understands where the tenths came from.
Leaving no trace in the program: when the work offsets are written by the code, the operator looking at the table has no idea where those numbers came from.
Frequently Asked Questions (FAQ)
What does G10 L2 P1 mean?
Write into the work offset table (L2), in row number 1, which is the G54. P2 would be G55 and so on to P6 = G59; P0 is the common shift added to all of them. The values go after it, in X, Y and Z.
Does G10 replace the value or add to it?
It depends on the active mode: under G90 it replaces whatever was in the table and under G91 it adds to it. To set a work offset you use G90; to apply a wear correction measured on the part, G91. Write the mode in the same block as the G10 and do not leave it to whatever modal was there before.
Can you write tool offsets with G10?
Yes: on Fanuc, L10 and L11 for length geometry and wear, and L12 and L13 for the radius ones, with P giving the offset number. On a lathe the same block also takes the nose radius with R and the orientation with Q.
Is G10 dangerous to use?
It is, to the extent that it modifies permanent data without asking for confirmation and without leaving a visible trace. A wrong P wipes out a properly set work offset, and an inherited G91 shifts the zero on every run. Used with discipline, on the other hand, it takes manual typing out of the loop, which is the other source of errors.
What is the difference between G10 and G52 or G92?
G10 writes into the table: the value is stored, visible and available afterwards. G52 and G92 create a shift that lives outside the table and that somebody has to remember to cancel. When the data is permanent, G10; when it is a temporary shift inside a program, G52.