Macro in macro - STOP

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Macro in macro - STOP

Postby Pulcik » Wed Sep 30, 2020 11:51 am

Hi folks,

I have a question for you. I modified M6 macro and now I have another macro in M6 macro. So, macro inside a macro (it is WinForm). Works well, but I am thinking, how to kill the above M6 macro by the inner macro. Imagine dialog with OK and cancel (it is not standard dialog box). When I hit cancel, i want to stop the above M6 macro.
I can think of two ways to do that.
First is, that I can write a value to VAR and read that VAR in above M6 macro. When the inner macro write 0 value to VAR, the above M6 macro can read it and stop the macro.
Second is, that i can call the cycle stop button from inner macro, which affect the above M6 macro.

I assume, that I can even call some code in inner macro. At least the one, Cycle stop call. Do you know, what code it is. Because exec.stop affect only the inner macro itself. Not the above one. What I am trying to achieve, is to interrupt the whole M6 macro, but without the writing the cycle stop in status window.

Any hints?
Pulcik
 
Posts: 39
Joined: Thu Aug 27, 2020 10:04 am

Re: Macro in macro - STOP

Postby dezsoe » Wed Sep 30, 2020 7:54 pm

exec.Stop will not stop any macro, only if you handle the stop state by checking exec.Ismacrostopped(). If you don't want to call stop then you have to use a #variable, an LED, a field, a button state, a checkbox, a file, a value in the profile, a plugin or a variable in the modbus array to make M6 to stop. (Maybe, there are more possibilities.)

However, the best practice is pressing the Cycle stop by calling exec.Callbutton(130), because if you call the M6 from a g-code and you only cancel the M6, then the g-code will execute after the unfinished M6, which may cause some trouble. You should check in every critical moment for exec.Ismacrostopped().
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Macro in macro - STOP

Postby Pulcik » Sat Oct 03, 2020 1:03 pm

Ok, got it.

Thank you for consulting.
Pulcik
 
Posts: 39
Joined: Thu Aug 27, 2020 10:04 am


Return to Macros

Who is online

Users browsing this forum: Bing [Bot] and 7 guests