Linuxcnc Z Tool Offsets

jmcghee

Registered
Registered
Joined
Jul 16, 2014
Messages
38
Hey guys-
I’m an experienced manual machinist but 100% CNC neophyte. There’s probably an obvious answer to this, but I can’t for the life of me sort it out. I'm trying to program my Z tool offsets (3 axis mill) running Linuxcnc with Axis interface and am pulling my hair out. I've got 15 or so tools in holders that should handle 99% of the work I'll do. I set all the Z heights in the tool table by doing the following:
-Load the tool & MDI a T(n) M6 G43
-Selected "touch off to fixture"
-Very carefully jog down to a machined flat piece of stock and take a whisper cut
-Hit tool touch off button and leave at 0
I repeated that process for all the tools on the same flat surface. As I understand it, the Z offsets for each tool are now set relative to one another, but not in space.

Then I made a fairly simple program that uses all the tools, with all of them taking a facing cut. My process was to edgefind my origin and hit the "touch off" (not "tool touch off") button in X and Y, load the tool, jog down & take a whisper cut in Z, and "touch off" in Z. I was expecting this process to work (seems pretty straightforward) but it definitely didn't. Using the above it'll cut air, somewhere around 2" above the stock top.

After some advice online I added g59.3 in the MDI before the command above and that didn't work either. Rather than cutting air, it'd start tool one a few inches below the part surface.

I reloaded all my tools 3 separate times just to make sure I didn't make a math error, or change something inadvertently, but no luck. feel like I'm missing something simple, but can't get it. Anyone see something obvious I left out?
 
I'm even further behind you with LinuxCNC - just working on the electrical build now. First - have you asked on the LCNC forum? That's been a great LCNC-specific resource for me.

If you can't wait for that forum to respond, here's a little troubleshooting:

Does LCNC require an "H" value to be entered? As a self-proclaimed neophyte, you may not be aware that some (quite a few, actually) CNC controls require the tool offset to be applied during a tool change - it's not automatic when you do a M6 Txxx. In those cases a tool change flows like this:

M6 T1 [tool 'call' for tool #1. May initiate an ATC change, or a prompt for a manual change]
G43 H1 [Apply tool length offset #1]

For my control, it looks like M6 T1 G43 H1

I think the intention with having the tool length offset NOT be automatic is that the "T" command, by itself, is used as a pre-fetch to stage that tool (in an ATC).

The other benefit is on a lathe... I can have multiple offsets for the same tool. Imagine a CNC lathe turret with 2 or 3 tools in the same station (center drill, drill, tap). Each would have its own X and Z offsets. So a tapping op with a 3-tool gang block would look like this:

T0101 (center drill)
M3 S2000
G0 X0 Z1
G73 Z-0.05 R0.25 (whatever the drill cycle & retract plane is)
G80
T0102 (turret retracts, doesn't turn, applies offset #2)
M3 S2000
G0 X0 Z1
G73 Z-1 R0.25 (drill to depth)
G80
T0103 (turret retracts, doesn't turn, applies offset #3)
M3 S1000
G0 X0 Z1
G83 Z-0.875 F(insert tapping pitch here)

Yada, yada.

Point is, LCNC may require an "H" word or similar to apply the tool offset. The way to check what the heck is going on is to look at the offsets page and see what the tool offset is - not on the tool table page. Command a tool change in MDI and see if that new tool length is shown on the "TLO Z" field in the offsets page.
 
A few questions: Are you taking a light cut with every tool? If you are doing that, every tool is going to be referencing a slightly different height, so the offsets won't be accurate.

Try this:
Load tool 1
In MDI use "T1 M6" (leave off the G43 for now, there is no tool length offset stored yet)
Jog down to the top of the stock and take a light cut
Click "Tool touch off"

Repeat here
Jog back up, change to tool 2
In MDI use "T2 M6"
Come back down and use a piece of paper to touch the tool to the top of the material
Click "Tool touch off"
Repeat previous 4 steps for a few more tools

Once you get to tool 4 or 5 check to see if everything is being saved correctly by doing this:
Insert tool 1
In MDI "T1 M6 G43 H1"
Jog down to the top of the material and use a piece of paper to get the tool at the same height as the stock
Click "Touch off" to touch off the Z axis - Set to zero
Jog back up and put in another tool, any of the ones already touched off will do fine. Ill say you picked tool 3
In MDI "T3 M6 G43 H3"
Jog back down and use the paper to get the tool at the same height as the stock
If all went well, the Z axis position in the Axis GUI should read "0.0000" or pretty close to it. If it doesn't say that, let us know what it does say and maybe we can figure out what is going wrong from there.
 
I'm not a Linux CNC guy (Mach 4) but perhaps my workflow could help you.

I use Tormach TTS, although this could work for any toolholder that has dual contact clamping (flat face that touches the spindle nose.

All my tools are measured on the workbench on a surface plate. The tool sits in a hole in the surface plate so the contact face is against the top of the plate. You can also machine a basket to hold the tool as long as the gage face is parallel to the plate below. Using a dial height gauge, I measure the length of the tool from the gage face to the tip. This gets entered into the tool table as a positive number. This of it as the absolute distance the spindle must be raised to keep the tip of the tool at the correct Z height.

As a bonus, Tool 1 is always my ball type edge finder with a fixed tool length. I use it to locate part corner, then the top of the part. Once tool 1 is zeroed in Z, all tool offsets are relative to that.

Tool changes must execute G43 Hxxx in order to load the correct tool offset. Mach 4 does not warn when the T & H numbers do not match.

M06 T08
G43 H08

The sequence above correctly loads tool 8.

The process above should be no different if you are touching off tools.
 
Ok, the LinuxCNC documents section has an explanation of the M6/Tx/G43 behavior. I've highlighted red what i think may be the OP's issue:

27. G43 Tool Length Offset​


G43 <H->
  • H - tool number (optional)
G43 enables tool length compensation. G43 changes subsequent motions by offsetting the axis coordinates by the length of the offset. G43 does not cause any motion. The next time a compensated axis is moved, that axis’s endpoint is the compensated location.
G43 without an H word uses the currently loaded tool from the last Tn M6.
G43 Hn uses the offset for tool n.
NoteG43 H0 is a little special. Its behavior is different on random tool changer machines and nonrandom tool changer machines (see the Tool Changers section). On nonrandom tool changer machines, G43 H0 applies the TLO of the tool currently in the spindle, or a TLO of 0 if no tool is in the spindle. On random tool changer machines, G43 H0 applies the TLO of the tool T0 defined in the tool table file (or causes an error if T0 is not defined in the tool table).
G43 H- Example Line
G43 H1 (set tool offsets using the values from tool 1 in the tool table)
It is an error if:
  • the H number is not an integer, or
  • the H number is negative, or
  • the H number is not a valid tool number (though note that 0 is a valid tool number on nonrandom tool changer machines, it means "the tool currently in the spindle")
 
A few questions: Are you taking a light cut with every tool? If you are doing that, every tool is going to be referencing a slightly different height, so the offsets won't be accurate.

Try this:
Load tool 1
In MDI use "T1 M6" (leave off the G43 for now, there is no tool length offset stored yet)
Jog down to the top of the stock and take a light cut
Click "Tool touch off"

Repeat here
Jog back up, change to tool 2
In MDI use "T2 M6"
Come back down and use a piece of paper to touch the tool to the top of the material
Click "Tool touch off"
Repeat previous 4 steps for a few more tools

Once you get to tool 4 or 5 check to see if everything is being saved correctly by doing this:
Insert tool 1
In MDI "T1 M6 G43 H1"
Jog down to the top of the material and use a piece of paper to get the tool at the same height as the stock
Click "Touch off" to touch off the Z axis - Set to zero
Jog back up and put in another tool, any of the ones already touched off will do fine. Ill say you picked tool 3
In MDI "T3 M6 G43 H3"
Jog back down and use the paper to get the tool at the same height as the stock
If all went well, the Z axis position in the Axis GUI should read "0.0000" or pretty close to it. If it doesn't say that, let us know what it does say and maybe we can figure out what is going wrong from there.
First off I wanted to say thanks for all the replies, this process has been extremely frustrating. I'm not really taking a cut, just using the known surface to touch off... jogging down .0001 at a time until it just barely touches a the blued surface. Margin for error being less than +- a tenth which is far more accurate than I or this old machine will be capable of working to. And it hasn't been a couple tenths or even a few thou off, its usually an inch or two or three. I went through the above, and everything checks out... each paper touch off is accurate & repeatable to less than a thou. What'd be the next step?

*Edit* Adding the H(n) did it! Just ran a program with 9 different tools and it worked beautifully!
 
Last edited:
*Edit* Adding the H(n) did it! Just ran a program with 9 different tools and it worked beautifully!
Well done. Keep pecking away at it and you'll soon be teaching the rest of us about LinuxCNC.
 
Now that I’ve got that sorted I've got a follow up question that’s giving me some analysis paralysis... what would the procedure be to add a single new tool/swap out a broken tool? Every tool I have accurately set up right now would be a known good reference right? In my head I should be able to pick any tool, and go through the following:
-Face a piece of stock with a “known good” tool
-mdi T(n) M6
-check “touch off to fixture”
-hit “tool touch off” (not “touch off”)

-load the new tool
-mdi T(n) M6 G43 H(n)
-touch off on my faced surface
-hit “tool touch off”

Does this seem correct? I’m nervous to start trying and checking because I don’t want to inadvertently mess up the offset on a tool that’s already set up and have to start all over, but it seems to me that’s how you’d add a new tool?
 
First question... what tool holder/taper are you using?

Cause if you're using something with a repeatable Z-axis you can measure the new tool off-line with a height gauge. You'd compare it to a known tool and then enter the offset in the tool table (known tool offset, plus/minus difference of new tool).

As to your procedure, that's really LinuxCNC-specific. I'm not familiar enough (yet) with the L-CNC terms like "touch off to fixture" and what exactly they do. You should ask on the L-CNC forum and report back if you're feeling charitable.

I bet youtube may also have some videos of tool setup.
 
Back
Top