#103 Fanuc-style toolchange commands for lathe

Daniel Rogge

I've brought this up before on IRC as well as on the dev list. I've completed work on changes to the interpreter and have tested these changes for the last few weeks. I hope others have enough use for this that it can make it into the code base.


On Fanuc-controlled lathes (as well Fanuc-like lathes like Haas, Okuma, and likely others). tool changes are not commanded with an M6, and offsets are not applied with G43. Rather the T word both commands a tool change and applies offsets. The offsets on Fanuc lathe controls are stored in two separate registers: geometry and wear. The wear offset register has IDs in the 1-99 range, the geometry offset register has IDs in the 10001 - 10099 range.
A T word followed by one or two digits causes a tool change and applies only the geometry offsets. A T word with three or four digits also applies the wear offsets.


“T01xx – selects the tool mounted in position one and activates geometry offset number one.
Txx01 – selects the wear offset register number one.
T0101 for turret station one, applies geometry offset one, applies wear offset one.
T0111 for turret station one, applies geometry offset one, applies wear offset eleven.
The first pair of numbers is always the tool station number and geometry offset, the second pair is the wear offset register. For gang tooling, the tool station is irrelevant. For ATC, the T call must also perform a tool change request.”

The Fanuc language with respect to tool changes, geometry and wear offsets for industrial lathes is described in detail by Peter Smid in his book CNC Fundamentals. Offsets can be stored with G10 L1, where a P value less than 100 will store wear offsets and a P value between 10001 and 10099 will store geometery offsets.

The attached patch enables this method of changing tools when the correct feature is enabled in the RS274NGC section of the INI file. Default functionality is not affected by this patch.

To try it out, add the line FEATURES = 64 to the RS274NGC section of your INI file (or modify your FEATURES mask if you’re already using RS274NGC features, documented here: http://www.linuxcnc.org/docs/devel/html/remap/structure.html#_optional_interpreter_features_ini_file_configuration_a_id_sub_ini_features_a\)

To answer the question of why you would want to use this feature:

1. It’s a more standard way of calling out tool changes in lathe g code – programs that ran on a FANUC-controlled lathe require fewer modifications to be compatible with LCNC.
2. It makes correcting for wear easier (no math on the part of the operator)
3. To hit tight tolerance with the same tool on more than one diameter - a different wear offset can be used for each diameter
a. Example – diameter A is 2.000 -0. +0.003, diameter B is 3.000 -0.003 +0. Very hard to hit with the same tool AND wear offset.
4. So that the program can use a nominal dimension
a. Example: the drawing uses unilateral tolerance of 3.000 +0.002 - 0.000. Instead of programming 3.001, you can program 3.0 and use a wear offset of 0.001.

Because of the limitations of NML message size, the tool table cannot have more than 56 pockets. When wear offsets are stored in separate registers, the number of tools available to the user when using this feature is half of that 56 (28) because both wear and geometry offsets must have pocket assignments to be accessed by G10 L1 and by status.tool_table[]. Even with the NML message size changed (if this happens in the future) the Smid/Fanuc syntax limits the number of tools to 99.

Thank you,



  • Rick Lair
    Rick Lair


    This is Lair82 from the Linux CNC forum,

    We added this patch to our configuration a few weeks ago, and it is exactly what we have been looking for. The normal tool table is fine I'm sure for certain applications, but in our industrial style setting it just was not a good fit. We have run multiple programs since adding this, and really only have one slight issue, we would like to be able to enter the diameter value, not the radius value. We run everything in our shop based on diameter, so it was it was a little awkward for our operator. Don't get me wrong, we love it though, and this really brings it up to the level and par of the fagor and fanuc controls, of which we have both.

    Hopefully this can be added to linux as a standard option that would be selectable between the standard tool table and this tool table in the INI, along with being able to select how the wear offset is input(DIA or RAD).

    Thank You