Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: Flying Scot on May 11, 2020, 11:27:10 AM

Title: Tool change Problem.
Post by: Flying Scot 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

Art
Title: Re: Tool change Problem.
Post by: SwiftyJ 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
Title: Re: Tool change Problem.
Post by: Flying Scot 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
Title: Re: Tool change Problem.
Post by: Flying Scot 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

Art
Title: Re: Tool change Problem.
Post by: smurph 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. 

Steve
Title: Re: Tool change Problem.
Post by: Flying Scot 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.

Art
Title: Re: Tool change Problem.
Post by: Flying Scot 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.

Art
Title: Re: Tool change Problem.
Post by: smurph 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)
M02
%

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. 

Steve
Title: Re: Tool change Problem.
Post by: Flying Scot 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

Arthur

 


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")
 else
        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")
        end

end

if (mc.mcInEditor() == 1) then
 m6()
end
Title: Re: Tool change Problem.
Post by: Stuart on May 13, 2020, 07:51:25 AM
Arthur

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
Title: Re: Tool change Problem.
Post by: Flying Scot on May 13, 2020, 08:55:23 AM
Hi Stuart,

Is probably something stupid I am doing but it is very confusing and I am not making a very good job of explaining it.
On my mill in Mach3 I have permanently set tools and tools that require the length checked each time and it all works fine.

This is a new router I have built and at present I only have a few collets and so I have to change tool in collet now and again. I prefer to send spindle to check tool length at every tool change.
I start by selecting T1 which has zero offset set and setting G54 in the offsets section of Mach4 setting Z on an 8mm tool plate.
I then change to T2 say a 6mm cutter then set cutter offset in offsets section and the offset is set in tool table of -14.995.

I can then run a job with no M6 tool change with a single tool no problem.

Now to test the M6 tool change  I leave the same 6mm cutter in the collet and run T3 M6 G43 H3 ( this is just a test to try and find out what is wrong) the tool table shows the offset for T3 as -7.015. (as it is the same tool as T2 the offset should be -14,995)

If I then run T4 M6 G43 H4 again with the same 6mm tool fitted the offset now changes to -0.0080 (it should not change as is same tool that was fitted)
when I run it again as T5 M6 G43 H4 the offset returns to -7.015.  If I continue incrementing T and H the offset in the tool table keeps alternating  between -7.015 and 0.0080.
I know this is not normally what you would do in normal operation of the machine.
I am telling the machine a different tool is fitted, but is the same tool that has never been removed from the spindle so the tool table  so it should show the same offset each time.

Homing is very good on all axis even the 4th rotary one.

I don't build locos but I do have 1/3rd Burrell traction engine I have been building for many years.  Its mainly model Aircraft I build.

Workshops are a great place for self isolating.

regards

Arthur


Title: Re: Tool change Problem.
Post by: Bill_O on May 13, 2020, 09:00:01 AM
If you did not set the offset for  T3, T4 etc then they will be wrong.
Mach has no way to know that it is the same tool as T2.
You must set for each tool.

Bill
Title: Re: Tool change Problem.
Post by: Flying Scot on May 13, 2020, 10:50:26 AM
Hi Bill

The M6  macro  moves spindle to tool change position and  measures   the tool offset and updates the tool table.
But it is updating table with the wrong offset.

Arthur
Title: Re: Tool change Problem.
Post by: Bill_O on May 13, 2020, 11:15:52 AM
I could be very wrong but I think you need to change the selectedtool below to currenttool.



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")
        end
Title: Re: Tool change Problem.
Post by: Flying Scot on May 13, 2020, 06:42:12 PM
At last its all working.

I spent most of today going through Daz's tool change videos which helped me understand what was supposed to be happening.   
I think the biggest problem was me not understanding the process.

Using his M6 macro adapted for my machine tool changes  are all working accurately every time

It's at least 10 years since I set up my other machines on Mach3  and they have never given any trouble. (It seemed easier then)

Thanks again

Art
Title: Re: Tool change Problem.
Post by: Bill_O on May 14, 2020, 09:19:49 AM
What was the issue?
Title: Re: Tool change Problem.
Post by: Flying Scot on May 15, 2020, 04:43:49 PM
Hi Bill

Not really sure as I reloaded mach4 and started from scratch using Daz videos.

All working well today again

Arthur