Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 01:55:02 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Can the M3/4 macros be edited
Pages: 1   Go Down
Print
Author Topic: Can the M3/4 macros be edited  (Read 780 times)
0 Members and 1 Guest are viewing this topic.
Cncman2nv
Active Member

Offline Offline

Posts: 67


View Profile
« 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
Logged

Adam
melee
Guest
« Reply #1 on: December 29, 2009, 11:06:06 AM »

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

Logged
Cncman2nv
Active Member

Offline Offline

Posts: 67


View Profile
« Reply #2 on: December 29, 2009, 09:40:07 PM »

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
« Last Edit: December 29, 2009, 09:42:57 PM by Cncman2nv » Logged

Adam
Overloaded
Global Moderator
*
Online Online

Posts: 3,072



View Profile
« Reply #3 on: December 29, 2009, 10:30:52 PM »

MeLee's code works fine here, did you copy/paste ?

If IsActive (input1) Then
      code "M4"
Else
      DoSpinCW()
      Message "CW Rotation"
End If

Russ
Logged

"I haven't failed. I've just found 10,000 ways that won't work."         Edison

"You cannot help men permanently by doing for them what they could and should do for themselves."
Abe Lincoln
Cncman2nv
Active Member

Offline Offline

Posts: 67


View Profile
« Reply #4 on: December 30, 2009, 07:47:16 PM »

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!
Logged

Adam
Overloaded
Global Moderator
*
Online Online

Posts: 3,072



View Profile
« Reply #5 on: December 30, 2009, 08:40:24 PM »

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


* ScreenHunter_02 Dec. 30 20.35.gif (7.07 KB, 335x173 - viewed 98 times.)

* ScreenHunter_01 Dec. 30 20.30.gif (5.77 KB, 398x184 - viewed 77 times.)
Logged

"I haven't failed. I've just found 10,000 ways that won't work."         Edison

"You cannot help men permanently by doing for them what they could and should do for themselves."
Abe Lincoln
Cncman2nv
Active Member

Offline Offline

Posts: 67


View Profile
« Reply #6 on: December 30, 2009, 08:54:25 PM »

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
Logged

Adam
Overloaded
Global Moderator
*
Online Online

Posts: 3,072



View Profile
« Reply #7 on: December 30, 2009, 08:56:56 PM »

Another problem with your original,
you have   DoSpinCWW(),
instead of            CCW

Glad it's working for you now though.
Logged

"I haven't failed. I've just found 10,000 ways that won't work."         Edison

"You cannot help men permanently by doing for them what they could and should do for themselves."
Abe Lincoln
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!