Cancel a macro

If you have a question about the software please ask it here.

Re: Cancel a macro

Postby Vmax549 » Wed Apr 25, 2018 9:57 pm

HI Keith , no I did mean stop/cancel/kill what every you want to call it.

(;-) TP
Vmax549
 
Posts: 981
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby beefy » Wed Apr 25, 2018 10:55 pm

OK, but that's left me confused because you talk about leaving all outputs in their state they are at when you STOP / TERMINATE the macro, then afterwards RESUME from where you left off.

I'm obviously missing something. How do you terminate a macro, but then resume it say half way through where it was terminated ??

Or have I completely misunderstood you.
beefy
 
Posts: 185
Joined: Mon Sep 05, 2016 10:34 am

Re: Cancel a macro

Postby cncdrive » Wed Apr 25, 2018 11:07 pm

Terry,

Cancelling a macro would mean to kill the macro thread which is dangerous according to Microsoft and even in school when you learn programming they always theach to possibly never do that.
The macro is a thread which is started and is running and the only way to really stop it in the middle is to kill it's thread or to let it end it's run and to let it peacefully terminate.
The proper way is to let it terminate and let the programmer handle the possible scenarios of stopping event.
Killing the thread does not even guarantee when the thread will die, it may still live for a while and it may die in the middle of doing something leaving things half-way set is why it is dangerous.
The programmer can handle the different scenarios to let the macro end without issues which he has to handle like I described in my previous post.

I think many problems in Mach3 come from that they killing threads which can make things to go random and unexpected.
cncdrive
Site Admin
 
Posts: 1924
Joined: Tue Aug 12, 2014 11:17 pm

Re: Cancel a macro

Postby Vmax549 » Thu Apr 26, 2018 12:34 am

OK can a function be made to let it run to teh end BUT do not do anything. With teh current {ESC} you do not allow motion can you NOT allow tickling of teh outputs as well. I don't care about displaying ALL teh messages.

Keith the STOP remark for a responce about what Dezoe said about STOP cannot stop a macro as you may want to do things then restart.

I was explaining that {STOP} disrupted things in a macro more than {ESC} did. and if a macro was involved you cannot just restart after a stop.

In C# what does public void Kill() do ? It is a MS function.

It all sounds simple to do the IsMacroStopped() routine but with a macro that is already over 1k lines of code adding in that could easily add another 250-300 lines of code and make it more clunky than it is now.

Oh well it is what it is. May be time to think about a PLC route. Ladder I do understand. AND I KNOW I can make it behave like I need for an ATC control(;-)

(;-) TP
Vmax549
 
Posts: 981
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Dan911 » Thu Apr 26, 2018 1:02 am

Hi Terry,

Just reading through this informative thread and I'm also confused on what your after? You posted from start before anyone else it's not good or recommended to kill a thread.

What's wrong with this code??? When escape key pressed motion stops and you can set your port/pins, conditions to what ever you like when macro ends. If I'm missing something I apologize and please explain.

Dan

exec.Setoutpin(5,16);
exec.Setoutpin(5,17);
exec.Wait(10000);
exec.Clroutpin(5,16);
exec.Clroutpin(5,17);
exec.Wait(10000);
exec.Setoutpin(5,16);
exec.Setoutpin(5,17);

if (exec.Ismacrostopped())
{
exec.Clroutpin(5,16);
exec.Clroutpin(5,17);
return;
}
Last edited by Dan911 on Thu Apr 26, 2018 1:16 am, edited 2 times in total.
Dan911
 
Posts: 338
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Cancel a macro

Postby beefy » Thu Apr 26, 2018 1:03 am

Well the one thing I can say is this thread has been very informative.

Never had anything to do with tool changers (outside of work that is) but I'd thought if I ever make my own I'll go the microcontroller route. That now sounds even more viable after reading this thread.

Keith.
beefy
 
Posts: 185
Joined: Mon Sep 05, 2016 10:34 am

Re: Cancel a macro

Postby Vmax549 » Thu Apr 26, 2018 1:38 am

Well Sense Balazs mentioned Mach3 (;-) I toook a trip down memory lane and tested a version of a M6ATC that is similar to what I am working on in Mach3.

During teh run of teh macro IF I hit {esc} the macro stops dead. It does not cycle messages and does not toggle outputs. You do have the option to stop coolant and spindle on {Stop}.

Hitting {Stop} also stops teh macro dead in its tracks. It does not cycle messages and does not toggle outputs.

The reason I choose to USE UCCNC to do teh atc functions over a micro or PLC is we have a PC powerfull enough to send a man to mars and back. A controller powerfull enough that can easily send a man to teh moon and back. AND about 100 points of I/O that about 80% are never used.

When doing a tool change teh PC and controller and I/O is basically at idle doing much to do about nothing. SO why not put it to work. Remember teh idea is to have teh MACHINE work for you not YOU work for teh machine.

(;-) TP
Vmax549
 
Posts: 981
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Vmax549 » Thu Apr 26, 2018 1:42 am

Well Sense Balazs mentioned Mach3 (;-) I took a trip down memory lane and tested a version of a M6ATC that is similar to what I am working on in Mach3.

During teh run of teh macro IF I hit {esc} the macro stops dead. It does not cycle messages and does not toggle outputs. You do have the option to stop coolant and spindle on {Stop}.

Hitting {Stop} also stops teh macro dead in its tracks. It does not cycle messages and does not toggle outputs.

The reason I choose to USE UCCNC to do teh atc functions over a micro or PLC is we have a PC powerfull enough to send a man to mars and back. A controller powerfull enough that can easily send a man to teh moon and back. AND about 100 points of I/O that about 80% are never used.

When doing a tool change teh PC and controller and I/O is basically at idle doing much to do about nothing. SO why not put it to work. Remember teh idea is to have teh MACHINE work for you not YOU work for teh machine.

(;-) TP
Vmax549
 
Posts: 981
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: Cancel a macro

Postby Derek » Thu Apr 26, 2018 1:51 am

Terry is working on this for my new ATC that he and I designed. It works great except if there is a problem and I hit stop, ESC or estop all of the outputs go off and depending what position it is in can be either as simple as the main slide going back to park position or as violent as an arm holding a tool slamming into the mill head then dragging across it until it slams into the splash shield. If the macro would stop running and leave all the outputs in the state they were in I could then manually control the system and return it a move at a time back to their respective positions. My non programing mind would think this should be something basic but I guess not.

My non programing minds solution is to hook a solenoid air valve to an output that the stop button will control and it will kill the main air supply to the system. No air, no movement. Problem solved cave man style:)
Derek
 
Posts: 270
Joined: Mon Sep 05, 2016 9:57 am

Re: Cancel a macro

Postby cncdrive » Thu Apr 26, 2018 9:50 am

As I wrote the programmer can handle this situation. Example code with explanation is in my previous posts.
cncdrive
Site Admin
 
Posts: 1924
Joined: Tue Aug 12, 2014 11:17 pm

PreviousNext

Return to Ask a question from support here

Who is online

Users browsing this forum: Mario Soto and 2 guests