Hello Guest it is April 21, 2021, 02:37:17 PM

Author Topic: Tool change Problem.  (Read 657 times)

0 Members and 1 Guest are viewing this topic.

Tool change Problem.
« on: May 11, 2020, 11:27:10 AM »
I am having trouble with tool changes and offsets.
After finally making progress yesterday and being able to run a simple job on my new router I thought I had cracked it.

This morning I tried to run the same job and the dreaded tool problem started again.

The program calls the first tool m6 T10 followed by G43 H10, the spindle moves to tool change position and tool is measured and job starts. The measured offset is loaded into tool 15 of the tool table and the on screen the tool information shows T10 but offset 15. (the tool was cutting fresh air as T15 is longer than T10)
Tool 15 is the second tool to be used and it was the last tool change yesterday.
I decided to clear the tool table and start again.
This time the tool information showed T10 offset. although the table was cleared it had used the old T15 offset so it was cutting fresh air again.
I let it run until the next tool change m6 T15 again followed by G43 H15. The spindle moved to the tool change position but it did not stop to measure the tool but headed start back to start cutting. This time the tool info showed T10 offset 15.

I am using Mach4 Hobby  V4.2.0 4430.  should I update to a later version?
The M6 Macro is attached but it is the one from the NFS video altered to suit my machine.
The confusing thing is it worked yesterday.

Thanks in advance

Re: Tool change Problem.
« Reply #1 on: May 11, 2020, 12:56:16 PM »
If you go into Configure>Control and go into the 'Tools' tab, what do you have selected in the 'Tool change type' box?

There are two options: 'T on M6 line is next tool' or 'T on M6 line is current tool'. It might be that you need to select 'T on M6 line is current tool' if the other option is selected
Re: Tool change Problem.
« Reply #2 on: May 12, 2020, 06:45:10 AM »
Thanks for replying but I had already tried that.  I had noticed a few replies on the forum saying that.
I updated mach 4 to V 2.0.4470 last night but no change.
It seems as if it is adding the previous offset to the probed tool length.
I am very new to this type of programming  (I was more of a hardware guy before retiring so having a hard time identifying the problem.

I have tried DAZ's m6 as shown on his video but it locks up on the first M6 command. This may be due to changes in the firmware since he wrote it.

Back to core API
Re: Tool change Problem.
« Reply #3 on: May 12, 2020, 08:13:21 AM »
I think I may have discovered that the problem is not in the M6 macro at all but in settings somewhere

With Controller configured "T on M6 line is tool to use" I get the following results

If I take a single tool T5 and set the tool length by offset manually the offset is -14.9950 which is correct.
I then take the same tool and run:
T6 M6 G43 H6     The offset is -7.0150.   I then repeat the process incrementing the tool number and offset  with the following results.
T7 M6 G43 H7     The offset is -0.0080
T8 M6 G43 H8     The offset is -7.0150
T9 M6 G43 H9     The offset is -0.0080
And it continues the same

And it repeats. The small difference are probably  due to the touch plate not being fixed down yet.

Change to Controller config to "T on M6 line is next tool"

T13 M6 G43 H13   The offset is -7.0390
T14 M6 G43 H14    The offset is -7.0390

The difference from the manually set offset is 7.956  THE THICKNESS OF MY TOUCH PLATE is 8mm

I have the thickness of the touch plate is set in Probing Calibration and Touch. Have I forgot to set it elsewhere?

Thanks in advance


Offline smurph

  • *
  •  1,384 1,384
  • "That there... that's an RV."
    • View Profile
Re: Tool change Problem.
« Reply #4 on: May 12, 2020, 07:45:12 PM »
Art, the "Tool on the M6 line is next tool" is for tool changers that preload the next tool.  Unless you have one of these preload style tool changers, this is NOT what you want. 

Re: Tool change Problem.
« Reply #5 on: May 12, 2020, 07:56:29 PM »
Hi Steve.

If I use the "T on M6 line is tool to use"my tool length keeps  changing as shown. Have you any idea why this is happening.

Re: Tool change Problem.
« Reply #6 on: May 12, 2020, 07:59:15 PM »
Hi again Steve

I tried to attach the m5 macro to the post but for some reason it is not showing.


Offline smurph

  • *
  •  1,384 1,384
  • "That there... that's an RV."
    • View Profile
Re: Tool change Problem.
« Reply #7 on: May 12, 2020, 10:58:56 PM »
I don't know what you mean about "taking the same tool and run"...  Do you have entries defined in your tool table?  All for them for the same tool? 

Also, try putting the G43 Hx on their own line. 

The preload tool changer G code goes something like this.

T1 (preload tool 1 into the tool changer, no tool in the spindle)
T2 M6 (load tool 1 into the spindle, preload tool 2 into the tool changer)

It will NOT change your offset.  It will change which tool Mach thinks is actually in the spindle!  So your H code was different than the tool Mach actually thinks is loaded in the spindle.  The fact that the offset is closer that way tells me that you have something else going wrong somewhere. 

Re: Tool change Problem.
« Reply #8 on: May 13, 2020, 03:01:51 AM »
Hi Steve,

Thanks for spending the time on this I have been going round in circle for days on this one, even thought about going back to an old PC on windows 7 and Mach3.
I am new to Mach 4 but have been running mach 3 for ten years making model parts on my Boxford Mill and Boxford Lathe with tool turret. The plan was to update them to Mach 4 and windows 10 on new pcs with windows 10 and ESS.

I have tried G43 on next line but it makes no difference.

I am using an ER16 collet chuck on my router spindle.
I was leaving the same tool in the chuck as a test to try and Identify the problem. This tool was initially measured manually in the offset window giving an offset of -14.995 which is correct. (my tool plate is 8mm)

I did not change the tool as I was trying to identify the problem using the entries in the tool table.
By only changing the tool number and the offset number in the MDI line "Txx M6 G43 Hxx"  the tool table should show every entry as being the same length for each tool but as shown it does not.
That's why I am confused when using "T on M6 line is tool to use" The offset keeps changing each time and it is always wrong.
I have managed to attach the M6 macro I am using.

Best regards



Code: [Select]
function m6()
local inst = mc.mcGetInstance()

mc.mcCntlGcodeExecuteWait(inst, "G53 G0 Z0\nG53 G0 X700 Y65")--Move the Z to Home.Then to the X, Y Coords for our touch pad.
mc.mcCntlSetLastError(inst, 'Now in Tool Change Position. Hit Cycle Start!')
local posmode = mc.mcCntlGetPoundVar(inst, mc.SV_MOD_GROUP_3) --get the current mode so we can return to it when macro ends
local selectedtool = mc.mcToolGetSelected(inst)
local currenttool = 1--mc.mcToolGetCurrent(inst)
 if selectedtool == currenttool then
        mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
        mc.mcCntlToolChangeManual(inst, true);
  mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedtool) .. "   Previous Tool == " .. tostring(currenttool))
  mc.mcToolSetCurrent(inst, selectedtool)

local MyChoice = wx.wxMessageBox("Click Ok to Begin Probing the New Tool connect probe","Click OK to continue" , 16)
        mc.mcCntlSetLastError(inst, "Probing in Progress!")
        mc.mcCntlGcodeExecuteWait(inst, " G91 G31 Z-150. F125.")--probe the new tool
local probedz = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_POS_Z) -- Z Probe position in Machine coords
        mc.mcCntlGcodeExecute(inst, string.format('G ' .. posmode))--return to pre macro mode G90, or G91
  mc.mcCntlGcodeExecuteWait(inst, "G00 G53 Z0 ")--Retract
local NewOffset = probedz
  mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, selectedtool, NewOffset)
  mc.mcCntlSetLastError(inst, string.format("Auto tool setting complete, Offset = %.4f", NewOffset))
wx.wxMessageBox("Toolchange Complete.\nTLO Set")


if (mc.mcInEditor() == 1) then

Offline Stuart

  •  261 261
    • View Profile
Re: Tool change Problem.
« Reply #9 on: May 13, 2020, 07:51:25 AM »

You have me confused no end

You said I have a er collet on the spindle  ok
So you only swap out the bit not as do i have 20 mtb2 er16 holders with different tools in each I use the very famous “mandraulic tool changer “
Therefore all my tools in the mach4 tool table have a different  h offset

And are called up thus m6 txx g43 hxx

Your post above you say the tool is correct h offset as measured ? We’re from spindle nose or WHY
You should set the tool in mdi as m6 txx then set your offset ? How are you setting the offset
But that is only correct for that tool ,change the tool and reset the offset

From your comments you say all the tool offsets in the tool table should be the same ? They cannot be

? Have you got homing limits and will the mill repeat it’s homing accurately

My set up note I am a hobbies in the UK and have made many 5 g loco’s br class 4 tank was the last all rivet perfect
On the cnc mill 4 axis I have 9 limit switches and it homes to 0.001 mm and I use a 3D taster to set the WCS and I use a tool setter 50mm using the table ( stored in g56) place the setter and set the tool length with a 50mm gauge in the offsets page

As all tools are pre set I can just let the gcode call up the tool for the mandraulic tool changer

I hope I have not rambled on to much but I do think it’s the way you are using the tool management that is causing the issue

Regards from a locked down 👨‍🦽very long beard and hair over 70. Stuart