Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: fragger6662000 on July 17, 2012, 09:06:31 AM
-
I have macros that have branches with END statements which rely on captured data from the machine to make them work.
the issue is that when i load a toolpath into mach these branches are causing the machine to stop processing the toolpath.
The simplest example is if you had a door which opens during tool change, and you check that it is open before changing the tool.
i have tried the following
if _____
else
message "ERROR"
code "M0"
dobutton(3)
END
END IF
the do button 3 just generated and error, I am trying to activate cycle stop but vb manual does not refference it.
the end cause the program not to generate so it cannot be run
-
You are trying to mix motion control in both CB and Gcode. It does not mix well. IF you want to stop then use the feedhold stop method as the M0 routine may or may not do anything in that situation.
If Not (door open) then
message "ERROR, DOOR NOT OPEN"
DoButton(1)
Whle Ismoving()
Wend
dobutton(3)
END
END IF
-
but the issue is that when the macro is called in the gcode the end will not allow the gcode to pre-process and there for run.
-
The "end" statement in a CB macro has nothing to do with the G code side of mach3.
Please post an example of how you think it applies.
(;-) TP
-
create a g-code program that call the macro and try and run it.
G code
g1z10
g1 x10 y10
m1000 (macro call)
g1x0y0
m30
%
-
OK did that runs fine. What is IN your M1000 macro??? Obviously something is in your macro that kills the G code side as well.
(;-) TP
-
the m1000 macro would contain the code
If Not (door open) then
message "ERROR, DOOR NOT OPEN"
DoButton(1)
Whle Ismoving()
Wend
dobutton(3)
END
END IF
or is there a better way of calling the macro.
-
IF you use that code then of course you stopped the Gcode program with the DoButton(1) and Dobutton(3). IT is not going to restart on its own(;-).
IF you want it to contunue after you have opened the door you have to provide code to do so. Or Create Code to wait on a response like open the door. These piece of code gives you one chance to open the door then ends the program. The Msgbox will prompt you to open the door . IF you do, then press OK then it ends the macro and the G code continues if not then it ENDS the Gcode program and you have to start all over again as the DOOR switch has failed.
If NOT Isactive(signal1) then 'The Door Open statement was just an example of you calling the state of the Door Switch it is NOT real code to be used
MsgBox" Door Not Open, Please Close To Continue or ELSE program will stop"
End IF
If NOT Isactive(signal1) Then
Message" G Code Program has ENDED due to Door ERROR. CHECK door switch "
DoButton(3)
End
End IF
THERE ARE many ways to do this you just have to pick a method then follow up with the correct macro code.
Just a thought, (;-) TP
-
you are not understanding my point
if you embed the code in a g-code program it carries out a preproses of the code before it runs.
that then prevents further action or running of the code.
-
Go to Gen Config page , Do you have "Ignore Mcalls when loading " checked??
(;-) TP