Hello Guest it is December 06, 2019, 09:20:32 PM

Author Topic: Mach4 M6 Macro problem  (Read 3282 times)

0 Members and 1 Guest are viewing this topic.

Offline Bob49

*
  •  57 57
    • View Profile
Mach4 M6 Macro problem
« on: April 07, 2017, 09:30:02 PM »
HI,

Been working on getting tool changes to function in Mach4.  I mostly have tool changes working from the MDI, but there’s oddities there.  In my written programs though tool changes mostly get jumped over.  Initially I found there was no m6 macro in my machine profile.  Simple enough to solve, but I had gotten a few tool changes to work in the MDI without there being a macro.  I shrugged that off and plowed ahead with the one I copy and pasted in.

Testing tool changes in the MDI became dependable except for the number in the tool # dro.  It seems to drag up the last tool number I had when I shut the system down earlier.  An example would be I had tool 19 mounted and had applied a g43 for that tool, then shut Mach down.  Next time I start Mach, I might have tool 19 displayed and I might not.  But now I want to mount tool 1, so I command a T1 M6 in the mdi.  If tool 19 was displayed in the dro at that time, mostly it will change to tool 2.  If I hit cycle start one more time, then the dro will finally display tool 1.  That’s the MDI oddity.

In my programs though is where it starts to really break down.  On initial launch of the program, it may stop at the T# M6 and allow me to change tools, or it may jump right over it.  This occurs with no change to the program, it’s for testing tool changes with slight x, y, z moves in between.  And of course if it jumps the M6, it has the wrong tool for the upcoming G43.

But if I succeed in getting the first tool changed at the first M6, I’ve never gotten the second M6 to halt the program and allow a tool change.  It just gets jumped.  Then I abort the test.

My system is running Mach4 build 3233 and an ESS with plugin 193.  I’ve been reading all I could find on tool change problems for the past few days but not gotten to the point I think any of what I’ve read might be the cause for my problems.  But that could be all on me not making a connection.  I do have a question on one bit I read yesterday, what is the sim plugin in the plugins folder?

Here’s the m6 macro I’m using for testing.

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: Mach4 M6 Macro problem
« Reply #1 on: April 20, 2017, 04:33:06 PM »
Mach Config->Tools Tab.  Make sure "T on M6 line is tool to use" is selected.

Steve

Offline Bob49

*
  •  57 57
    • View Profile
Re: Mach4 M6 Macro problem
« Reply #2 on: April 20, 2017, 05:04:38 PM »
Thanks for the response Steve, I had it set to what the default was...tool is next.  Seemed logical, but I have to say, I really didn't understand that part of the config.  I got some work on the mill right now, but soon as thats done I'll get back to testing tool changes via programs.

Thanks again
Bob
Re: Mach4 M6 Macro problem
« Reply #3 on: April 29, 2017, 07:08:07 PM »
I have a related problem and I am probably missing something obvious.
Same initial conditions: The previous program ran with for example T22 and Mach4 was shutdown and the tool removed.
Next time a program that needs T22 is run Mach4 thinks that the tool 22 is still in the machine and it skips the tool change and of course it does not work well to mill without a tool.
What am I missing? How can I automatically clear the old tool settings.  As far as I am concerned it ought to automatically clear the tool setting.
Bertho

Offline Bob49

*
  •  57 57
    • View Profile
Re: Mach4 M6 Macro problem
« Reply #4 on: April 29, 2017, 07:29:18 PM »
Yep, the tool used last is persistent and will show up once Mach is started again.  It also starts with tool heights off (sort of a G49 condition), but that can be toggled back on on the offsets screen, upper right hand corner.

I've found with my home switches, Z repeats very well from shutting down Mach to starting Mach again and then toggling the tool height offsets on with that button.  But mostly I start with tool 0 and do a T0 M6 tool change, load my edge finder and move into a different work offset and find x0y0z0.  Then do another tool change to match the first tool in my program or whatever tool I need for running from the MDI.  Along with that, if in the MDI, I'll do a G43 to set my tool height for the current tool.  You don't need to toggle the tool height offset button for this to work.  Just if you want the tool that was in the spindle at the time Mach was shut down for the tool when it's started back up.

That's what I've found to be the case anyway.  And after Steve pointed me to the cure for my previous tool change problem, I've been running tool changes ver successfully.  And hopefully that description makes sense.

Regards
Bob
Re: Mach4 M6 Macro problem
« Reply #5 on: April 29, 2017, 08:00:56 PM »
We should not have to play games to make it work correctly.  There ought to be a way to clear the old tool without having to do dummy tool changes.
I always clear tool and other offsets as a first line of code and it ought to clear the tool selection too or at least have an option to do that.
There are so many options and I might be overlooking something.
Bertho

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: Mach4 M6 Macro problem
« Reply #6 on: April 29, 2017, 08:34:06 PM »
I want my tool to be the last one I used at startup.  So your version of "correct" doesn't match mine.  :)  Luckily, we wrote Mach 4 in a manner so that it will work any way you want it to.

Read the API manual and see what all is there.  You can make it work the way you want with a single line of code in your Screen Load script. 

Code: [Select]
mc.mcToolSetCurrent(inst, 0) -- if tool zero is the desired startup tool. 

Steve
Re: Mach4 M6 Macro problem
« Reply #7 on: April 30, 2017, 12:16:25 AM »
Thanks Steve,
That is why I wrote "option" since I figured someone wanted it that way.
Question:  Will the suggested line only work when Mach4 is started or will it work each time a program is started?

Offline smurph

*
  • *
  •  1,153 1,153
  • "That there... that's an RV."
    • View Profile
Re: Mach4 M6 Macro problem
« Reply #8 on: April 30, 2017, 01:02:27 AM »
Only when Mach 4 is started.  That is when the screen load script is run.  It will also run after editing the screen, as that is like starting Mach loading the screen.  If you wanted it to happen for every file load, you could put that string in the "Load File" button's up action script.  If you wanted to make it do that every time you start a file, put that in the Cycle Start buttons' up action script (checking for the G code line to be 1, etc..).

Steve
Re: Mach4 M6 Macro problem
« Reply #9 on: April 30, 2017, 08:15:06 AM »
OK, I understand, thanks.
Actually I have been looking at the M6 macro and I am thinking about removing the conditional "If the tool is the same..."
As far as I can see, a program would not have a tool change in the middle of a program to change to the same tool so it would not affect it.
At program start it would always stop for a tool change but that would be just one extra click on cycle start.
Is there an easy way to force Tool 1 in Gcode?  That way I could have it included as part of a default safe startup string.  Basically a T1 but without M6.