Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: sunmix on November 11, 2006, 04:16:10 AM
-
Hi, I'm new to this forum, but I have been a Mach user for 2 years, just that I didn't really play with macros. I'm setting up a oxy control, which control valves of oxy. and acet., to suit the traditional cutting style. As you can see, there are ignition delay, preheat delay and pierce delay, and 3 of them are controlled by 3 different outputs. The problem i'm facing is everytime i trigger this macro script, all the outputs triggers at the same time. I cant get it to delay before triggering another output. Can someone kindly help to neaten up the script? Thanks!
rem M3 Macro
Dim IgnitionDelay, PreheatDelay, PierceDelay
IgnitionDelay = getUserDRO (1001)
PreheatDelay = getUserDRO (1002)
PierceDelay = getUserDRO (1003)
ActivateSignal(Output1)
code "G4 P" & (IgnitionDelay)
ActivateSignal(Output2)
code "G4 P" & (PreheatDelay)
ActivateSignal(Output3)
code "G4 P" & (PierceDelay)
End
-
This is what I like to see :) you tried and all I have to do is a little work to the script! You get a star for the day ;)
Okay you are VERY close to haveing what you need... this should work for you:
Rem M3 Macro
Dim IgnitionDelay, PreheatDelay, PierceDelay
IgnitionDelay = getUserDRO (1001)
PreheatDelay = getUserDRO (1002)
PierceDelay = getUserDRO (1003)
ActivateSignal(Output1)
code "G4 P" & (IgnitionDelay)
While IsMoving()
Wend
ActivateSignal(Output2)
code "G4 P" & (PreheatDelay)
While IsMoving()
Wend
ActivateSignal(Output3)
code "G4 P" & (PierceDelay)
While IsMoving()
Wend
End
-
Whoa! Thanks!!!! I've been waiting for this moment for a long, long time! Thanks!!!
What's the difference between WEnd, Sub End, and End?
-
Sub End is to end a Subroutine
Wend is the end of a While loop
End ... there is no end :) There is an End if and this tells the end of an if statement
Thanks
Brian
-
While your on about controlling outputs, how do you turn them off.
Thanks
Chris
-
DeActivateSignal(Output3) That will do it :o
-
I've sorted it, I was been dumb, if anyone wishes to know it's simple really DeActivateSignal(output5)
This is what I'm trying to do. Hopefully it will turn my spindle on on my bridgeport series 1 boss machine when I wire it in.
M3.m1s
If (GetOEMDRO (56) = 1) Then
DoSpinCW()
ActivateSignal(Output5)
Message "Spindle Start Requested"
SystemWaitFor(Input2)
While IsMoving ()
Wend
DeActivateSignal(output5)
Message "Spindle Start Delay"
Code "G4 P2"
While IsMoving
Wend
Message ""
Call SetUserLED(1010,1)
End If
If (GetOEMDRO (56) = 2) Then
DoSpinCCW()
ActivateSignal(Output6)
Message "Spindle Start Requested"
SystemWaitFor(Input2)
While IsMoving ()
Wend
DeActivateSignal(output6)
Message "Spindle Start Delay"
Code "G4 P2"
While IsMoving
Wend
Message ""
Call SetUserLED(1010,1)
End If
It's a bit long but it seams to work when I simulate it, the M4 ones the same but the other way around.
Cheers
Chris
-
No problem :) Looks like you are getting it!