Hello Guest it is March 28, 2024, 09:52:16 AM

Author Topic: Mach 4 not stopping at manual tool change  (Read 4098 times)

0 Members and 1 Guest are viewing this topic.

Mach 4 not stopping at manual tool change
« on: January 01, 2019, 02:06:39 AM »
Hello all, just upgraded from Mach3 to Mach4. Using the same post processor in Fusion360 as mach3 as it doesn't list one for Mach4?

During a manual tool change Mach4 is not stopping like mach3 did ie.

M1
T4 M6

Do I need to use a different code? Or change a setting? is there a Mach4 post for Fusion?

Just reading through the manual, it says M1 is a Optional stop... using WXrouter screenset under "run ops" tab do I need to have the optional stop button on???

If so is there a way I can make it always on? Id hate to forget to turn on it once and ruin a job

Thanks

« Last Edit: January 01, 2019, 02:18:36 AM by Viperx85 »
Re: Mach 4 not stopping at manual tool change
« Reply #1 on: January 01, 2019, 03:07:38 AM »
Hi,

Quote
is there a Mach4 post for Fusion?
I'm not really up to date with Fusion but I don't think there is a specific post for Mach4, most users carry on using the post for Mach3.
Whether any alterations have to be made is more than I can answer.

The toolchange macro M6 is another matter entirely. As you no doubt are aware that an M6 which works on one machine, even a manual
toolchange may well crash another machine, and just about every machine is different.

In the Mach4Hobby/LuaExamples/ToolChanger folder you will find some very basic toolchange M6 scripts that have been supplied by NFS,
in the hopes that one or more of them may, with a little tweaking, suit your machine. I would recommend you have a look to see if one may
work for you and/or at the very least show you some of the techniques that are available to you to tweak an example to your circumstances
or even writing an entirely original script.

Without more information about your machine I could not give you any specific instructions as how to proceed. There are a few general ideas,
and one or two quirks that you need to be aware of if you go to modify or write anew.

The first is that M6 is a basic macro within Machs core. Whenever the GCode interpreter encounters an M6 call it executes it. If however you write your own
Mach will check that first, if it finds a complying M6 it will execute that instead, if it doesn't find one it executes its own M6 from within the core.

First quirk: Machs Gcode interpreter converts all alphanumeric data to lowercase and strips out leading zeros. Thus:
M6
M06
m6
m06
m006
all refer to the same thing. When Mach reads a line of code and it includes a 'M06' that you hand coded it will actually look for 'm6'
in its macro directory. Windows is ambivalent about uppercase/lowercase so Mach will find what its looking for.....mostly!!!
I would highly recommend that you code all Gcode in lowercase without leading zeros. The few occasions where Mach does not identify
M06 correctly will throw a fault that will DO YOUR HEAD IN BIGTIME!

Second quirk: is not really a quirk at all but a setting which determines how Mach will interpret an line like M6 T5 say.
There are two options, the first is that Mach will stop and execute the toolchange an will fit tool 5. This is natural to you and I but there is
another interpretation especially popular with industrial/production CNCers. Mach encounters M6 T5, it stops and executes the toolchange
but fits the tool in the carousel currently and then puts tool 5 in the carousel to be fitted at the NEXT toolchange. This has the advantage
of being fast.

If you are unaware and have a M6 which is meant to operate in one mode but the machine installation is set to the other mode
then the toolchange screws up royally! Its not often at all clear what the fault is.....you'd swear Mach has gone insane. You need to decide
on what toolchange mode suits you, make the setting in Configure/Control/Tools and write your code accordingly.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach 4 not stopping at manual tool change
« Reply #2 on: January 01, 2019, 03:11:57 AM »
Thanks for the in depth reply Craig, I do not have a ATC only manual tool changing... All I need mach to do is pause the program so i can manually change to the tool and touch off on my tool height probe.
Re: Mach 4 not stopping at manual tool change
« Reply #3 on: January 01, 2019, 03:16:23 AM »
Hi,
and Mach will do just exactly that, its what my machine does. That does not mean however that you can ignore the setting which I have alerted
you to. The wrong setting will cause even a manual change to fail.

Experiment with it until you understand or it will give you grief down the track.

Caig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'
Re: Mach 4 not stopping at manual tool change
« Reply #4 on: January 01, 2019, 04:44:39 AM »
Its actually more related to the M1 command in this case it seems, Mach4 has a "optional stop" toggle button.

I switched this on and it stops the program as Mach3 used to.

Seems I need to change my post processor to output M0 instead of M1 which is a mandatory stop and I dont have to worry about having the "optional stop" switch turned on.

I did sus out that "setting in Configure/Control/Tools and write your code accordingly." Though thanks
Re: Mach 4 not stopping at manual tool change
« Reply #5 on: January 01, 2019, 04:52:55 AM »
Actually doing abit more reading and in Mach4 I went to "operator" menu then "edit/debug scripts"

There was one called M6 and contained the following:
function m6()

   local inst = mc.mcGetInstance()
   local selectedTool = mc.mcToolGetSelected(inst)
   local currentTool = mc.mcToolGetCurrent(inst)
   
   if selectedTool == currentTool then
      mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")
   else
      --Remove this line if you would not like the Z axis to move
      --mc.mcCntlGcodeExecute(inst, "G90 G53 G0 Z0.0");--Move the Z axis all the way up
      mc.mcCntlSetLastError(inst, "Change to tool " .. tostring(selectedTool) .. " and press start to continue") --Message at beginning of tool change
      mc.mcCntlToolChangeManual(inst, true) --This will pause the tool change here and wait for a press of cycle start to continue
      mc.mcCntlSetLastError(inst, "Current tool == " .. tostring(selectedTool) .. "   Previous Tool == " .. tostring(currentTool)) --Message that shows after Cycle Start
      mc.mcToolSetCurrent(inst, selectedTool)
   end
end

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

But that was not happening for me? it was like Mach4 is just skipping past the M6 command?

Re: Mach 4 not stopping at manual tool change
« Reply #6 on: January 01, 2019, 07:15:53 AM »
Hi,
that is the bog standard m6 script that ships with Mach4.

Note this line:
Code: [Select]
if selectedTool == currentTool then
      mc.mcCntlSetLastError(inst, "Current tool == Selected tool so there is nothing to do")

it means that if the current tool is the same as the next tool the machine does nothing. Does that sound familiar to you?
For whatever reason your installation regards the current tool to be the same as the new tool. That smacks to me of the
difference of the interpretation of the T word in the Gcode line. Have you experimented with the toolchange mode as I suggested?

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'

Offline Stuart

*
  •  311 311
    • View Profile
Re: Mach 4 not stopping at manual tool change
« Reply #7 on: January 01, 2019, 09:12:59 AM »
Check your config under tools it should be the tool on the m6 line is th tool in use

There are two radio buttons use rage wrong one and it expects your guide to pre load the tool first

Re: Mach 4 not stopping at manual tool change
« Reply #8 on: January 01, 2019, 11:39:47 AM »
I am using the stock tool change m6 on a mill at work.  It works fine for me.  Do as Craig suggests and do some testing to be sure you have the T as Next Tool like Craig and Stuart have suggested.

Also, there is a Mach4 fusion post processor.  I asked Autodesk to add a G30 option instead of G28 and they got it put in the post for me.  This way you can set a Custom Rest Position to your machine.  I don't like my Z going to Z home at every tool change, so I made my G30 Z position about 8 inches below home and G30 X position in the middle of the travel for the end of program. 
Chad Byrd
Re: Mach 4 not stopping at manual tool change
« Reply #9 on: January 01, 2019, 01:50:29 PM »
Yep checked that setting and it is set as “T on M6 line is tool to use”

i’ll try it the other way.