CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 18, 2018, 06:57:04 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Mach3 - stop G-code execution from macro?  (Read 1118 times)
Dragonfly
CNC Jedi
*****
Offline Offline

Posts: 2018



View Profile
« on: March 06, 2018, 09:52:08 am »

I am trying to automate some repetitive actions to help me not doing things caused by concentration loss - like crashing the touch probe Sad
For this purpose I wrote simple G-code snippets which make extensive usage of custom macros.
There are cases when I'd like to cancel macro execution (done with simple MachMessage command) and stop further G-code execution. But can't find a way (if possible at all) to implement this. I've tried to execute M30 from the macro and tried also to execute 'Stop' button press with 'DoOEMButton' command but G-code execution continues nevertheless after macro code exits.
So I decided to ask here with so many Mach3 users whether it is possible and what I am missing.
Logged

Before asking a question do some effort and walk through all menus and options in CamBam.  Maybe the answer is there. Please.
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3609



View Profile
« Reply #1 on: March 06, 2018, 10:41:42 am »

Do you think it could be because of Mach3 "look ahead" ?

Have you explored using Mach3 'Brains' rather than macros ?
« Last Edit: March 06, 2018, 10:43:18 am by EddyCurrent » Logged
Dragonfly
CNC Jedi
*****
Offline Offline

Posts: 2018



View Profile
« Reply #2 on: March 06, 2018, 11:20:08 am »

Brains are a 'white spot' on the map for me. But I'll have to do some learning because I got interested in Modbus application recently.
Logged

Before asking a question do some effort and walk through all menus and options in CamBam.  Maybe the answer is there. Please.
dave benson
CNC Jedi
*****
Offline Offline

Posts: 975


View Profile
« Reply #3 on: March 06, 2018, 12:21:15 pm »

You would do something like this:

Code "G1 Z -20 F100"
While isMoving()
If (IsOutputActive(Output1)) Then
DoOEMButton(1003)
Sleep 100               
End If
Wend
this is part of a probing routine

Dave
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3609



View Profile
« Reply #4 on: March 06, 2018, 12:33:15 pm »

With Mach3 probing a G31 is usually used to enter the straight probing routine.
Logged
dave benson
CNC Jedi
*****
Offline Offline

Posts: 975


View Profile
« Reply #5 on: March 06, 2018, 12:55:04 pm »

That's true eddy, I was just showing how to stop mid stream so to speak.
that ones based on using G28.1 which you can also use.
Dave
Logged
EddyCurrent
CNC Jedi
*****
Offline Offline

Posts: 3609



View Profile
« Reply #6 on: March 06, 2018, 19:34:41 pm »

Dave, I realise that but I wondered if your code snippet still worked the same when not in a probe sequence.
Logged
Dragonfly
CNC Jedi
*****
Offline Offline

Posts: 2018



View Profile
« Reply #7 on: March 06, 2018, 21:27:12 pm »

I didn't use a pause  - Sleep(100) after calling  DoOEMButton(1003), maybe this is the reason because Mach3 is a bit slow reacting to those commands. Will try and report.
Logged

Before asking a question do some effort and walk through all menus and options in CamBam.  Maybe the answer is there. Please.
dave benson
CNC Jedi
*****
Offline Offline

Posts: 975


View Profile
« Reply #8 on: March 07, 2018, 04:29:03 am »

Hi DragonFly

Yes you should use the wait.
The macros are written with a proprietary stripped down version of vb.

Dave
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.118 seconds with 19 queries.

Copyright © 2018 HexRay Ltd. | Sitemap