Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: Cncman2nv on December 26, 2009, 07:13:01 PM
-
I would like to find a way to edit the way Mach does the M3,M4 macros
What I want to do is put a lever switch on the Back gear lever of a Bridgeport mill to tell Mach to reverse the output from the M code call
I tired this in the M3 macro but Didn't Work
IF IsActive (input1) then
DoSpinCWW()
Else
DoSpinCW()
End If
-
Hi
This brought back vague memories of when I tried something similar a couple of years ago, to overcome a logic problem on a machine, which I eventually cured the proper way by rewiring.
The answer is yes you can edit the macros, but you have to go outside the DoSpinC(C)W() functions if you want to change rotation direction from M3.m1s
I don't know exactly where the macro comes in the chain of processing a M3 GCode call, but as you say, simply substituting DoSpinCCW() does not produce the desired effect, albeit commenting out the command will prevent any rotation, so Mach does look for it in the macro.
I set the contents of M3.m1s as
If IsActive (input1) Then
code "M4"
Else
DoSpinCW()
Message "CW Rotation"
End If
and M4.m1s as
DoSpinCCW()
Message "CCW Rotation"
This gives me the desired effect in simulation, depending upon the state of input1 and a visible confirmation that the M4 call went through on the message line.
Hopefully will work for you
regards
Melee
-
I keep getting Scripter errors when using code in the M3.m1s getting a syntax error to the words then,else,if when stepping thru the code
-
MeLee's code works fine here, did you copy/paste ?
If IsActive (input1) Then
code "M4"
Else
DoSpinCW()
Message "CW Rotation"
End If
Russ
-
In my original post as you can see i didn't indent from the then,else,end if, statements I now no that makes all the difference
so Thanks for all the help!
-
Hi Adam,
I believe you had a different syntax problem.
The indent doesn't really matter. I think that's just an easy way for a programmer to read or work with the script.
These work just as well .
Russ
-
Ya your right Russ the indent doesn't make any difference so I don't what I had going on but it seem to work now
-
Another problem with your original,
you have DoSpinCWW(),
instead of CCW
Glad it's working for you now though.