Hello Guest it is April 19, 2024, 09:11:48 AM

Author Topic: Programs won't continue after m6  (Read 1024 times)

0 Members and 1 Guest are viewing this topic.

Programs won't continue after m6
« on: February 28, 2022, 10:20:55 AM »
I am still very new to Mach4 and I cannot get a gcode or MDI program to continue on after an m6 is called.
I have tried multiple (different) m6 macros; I either cannot get them to successfully run all the way through correctly, or they will not continue the program after running successfully.
It seems that Mach4 works differently day to day. Like it's pissed at me or something. I will have something almost nailed down, and the next day it will not work at all.
I have already had to start all over with the Mach install and 3 profiles.
The m6 has been my latest struggle. I do not know how to get the macro to set the offset how I want, and it will just stop after the macro and not continue.
I would imagine that Mach4 does allow a tool change sequence mid program?

If I could get some advice, I would greatly appreciate it. Mach Support will not help, they just close my tickets with no replies.

Thanks in advance
Re: Programs won't continue after m6
« Reply #1 on: March 02, 2022, 10:53:04 PM »
I have tried multiple (different) m6 macros;

have you debugged these macros in real time and verified that they run to completion without errors? if not, then try that and see if you find any errors. editing macros requires that you have some understanding of how to develop programs with LUA. if you don't know how to develop programs with LUA, either spend the time to learn it or hire someone short term to help you do it.
Re: Programs won't continue after m6
« Reply #2 on: March 03, 2022, 06:35:16 AM »
Thank you for your reply.
I have not used the debugging much at all. I've tried it a couple of times, and I didn't see that it was really doing much. Though that is probably my lack of experience and I wasn't fully running it correctly.
The macro does seem to run through, it gets to the end where it updates the offsets and gives the all finished message box.
I just cannot continue on with the gcode.

I will try tonight, or this weekend to look at the debugging a little bit closer.
Thank you for the advice, I appreciate it.

I will reply after I have tried it out a bit.

Thanks again.
Re: Programs won't continue after m6
« Reply #3 on: August 08, 2022, 05:14:20 PM »
does your m6 macro has a "return"

for example

Code: [Select]
if selectedTool == currentTool then
mc.mcCntlSetLastError(inst,'Tool Change activated not required')
return
elseif currentTool == 1 then  --DROP TOOL 1 BLANK AND COLLECT TOOL 2

mc.mcCntlGcodeExecuteWait(inst, "G90 G53 G0 Z-70 F3500")

return

end

Offline Bill_O

*
  •  563 563
    • View Profile
Re: Programs won't continue after m6
« Reply #4 on: August 08, 2022, 05:37:15 PM »
chaney,

Can you post the m6 you are using?

Also, I am not a programmer and had to really work at learning the Lua.
This might help you.
https://www.machsupport.com/forum/index.php?topic=45397.msg289143#msg289143


Bill
m06 still won't end and return to gcode program
« Reply #5 on: October 31, 2022, 04:05:08 PM »
I have still not gotten an m06 to successfully run.

I have my macro set to run like so; It will retract to safe Z height, and turn off the spindle. It then moves to a designated Tool Change position. When ready, Select ok & cycle start. It then moves over to my touch pad and probes. After making contact it should record the height, retract to safe Z height and start the spindle. It should then set Mach up to continue onto the gcod eprogram. A message box should pop up saying tool change complete. By pressing OK the macro should end and go back to the program.

When I run it in the debugging  in editor, it run all the way through. Compiles 100% and has no errors when analyzed. :o
This lead me to think I'm missing something telling it how to return to the current Gcode file.

I am currently running the latest Mach4 and Warp9 pluggin versions. The machine works properly including homing to limit switches.

I could really use some advice and direction on what to do. I have been working on this macro for so long with no avail.
It's the one thing keeping me from enjoying the fruits of aot of hard work.

Thanks in advance for any time and/or advice given.
« Last Edit: October 31, 2022, 04:20:11 PM by chaney »
Re: Programs won't continue after m6
« Reply #6 on: October 31, 2022, 07:07:46 PM »
Hi,

Quote
When ready, Select ok & cycle start.

Can you explain this a little more?  If I understand what you are saying is that the m6 macro starts a new cycle, that is, a different program. If that's the case then the old gcode
job is just that....old and aborted, you cant go back to it.

An m6 macro pauses the gcode job, releases the control of the trajectory planner to the macro interpreter, completes the task defined by the macro and then 'Returns', ie
resumes the gcode job. Note the the original job was paused...not stopped. Your <cycle start> suggests that you stopped or aborted the gcode job for which there is no recovery.

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

Offline Graham Waterworth

*
  • *
  •  2,672 2,672
  • Yorkshire Dales, England
    • View Profile
Re: Programs won't continue after m6
« Reply #7 on: October 31, 2022, 09:10:41 PM »
From memory I don't think you can use G91 in G53 mode without issues.
Without engineers the world stops
Re: Programs won't continue after m6
« Reply #8 on: November 01, 2022, 07:21:58 AM »
I am calling the m06 in a short gcode program. For now just a short program for testing the m06.
In the m06 macro there are occasions such as the manual tool change part that require a cycle start to continue onto the probing part.
After the probe has been made I added in a message box to see if the macro was making it to the end.
As far as I know I am not stopping the gcode run. In the gcode window and screen it shows it still being stuck on line 15(m06) and the tool change light is still blinking.
Now if I have unintensionally stopped the program, that would definetly be the issue, but as far as I know I have not done that.
After just seeing it do nothing for a bit of time after the m06 moves have been made, I attempted pressing the cycle start button. Just to see if it would continue. Nothing happens. When I press the cycle stop the last message box of the macro will pop up.
When I run through the macro in the debugging, it completes all the moves and all messages in the macro seem to be working as written. With no errors.
Unless I have made another error, there should also be no G91 being called.
I always try to stick with G90 and for all my testing and initial setups I have been using all G53 locations.
Re: Programs won't continue after m6
« Reply #9 on: November 21, 2022, 08:57:07 AM »
Update: I got some awesome help from Trevor at NFS with this.
My problem comes down to the lack of knowledge using LUA.
I had alot of extra, useless stuff in my macro, plus I was missing a couple things I didn't even know about.
Trevor helped me get it cleaned up so that I was only accomplishing what I wanted.
I now have a working M6 macro.
I didn't know about the machine push & pop, and I'm still unsure about what it is, but I'm pretty sure that it is what is keeping my macro in the order it needed to be.

Now I just gotta get that tool offsets figured out.

Thanks Trevor and those of you that posted. ;)