Hello Guest it is March 28, 2024, 05:39:37 AM

Author Topic: Terminate a brain with "run macro M650.m1s" ???????  (Read 39486 times)

0 Members and 1 Guest are viewing this topic.

Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #40 on: March 26, 2013, 08:36:23 AM »
with below, starting with LEDS off and DROs same.
clicking does nothing. if i change the position of XY and/or Z
the LEDs turn on for any axis that is different from userDRO.
click again and they turn off. clicking again changes nothing. as long
as the two DROs arethe same. turns on again if different. so i'm still
trying........

p.s. is there a doc for the different comparison"<>"

X_MovingLED = 1120
Y_MovingLED = 1121
Z_MovingLED = 1122

CurrXPos = GetOEMDRO(800)
OldXPos = GetUserDRO(2001)
CurrYPos = GetOEMDRO(801)
OldYPos = GetUserDRO(2002)
CurrZPos = GetOEMDRO(802)
OldZPos = GetUserDRO(2003)

If CurrXPos <> OldXPos Then
   SetUserLED(X_MovingLED,1)
    SetUserDRO(2001,CurrXPos)
Else
   SetUserLED(X_MovingLED,0)
    SetUserDRO(2001,CurrXPos)
End If

If CurrYPos <> OldYPos Then
   SetUserLED(Y_MovingLED,1)
    SetUserDRO(2002,CurrYPos)
Else
   SetUserLED(Y_MovingLED,0)
    SetUserDRO(2002,CurrYPos)
End If

If CurrZPos <> OldZPos Then
   SetUserLED(Z_MovingLED,1)
    SetUserDRO(2003,CurrZPos)
Else
   SetUserLED(Z_MovingLED,0)
    SetUserDRO(2003,CurrZPos)
End If
                     
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #41 on: March 26, 2013, 09:01:08 AM »
tried below with  Curr?Pos = IsMoving
with nothing changing

X_MovingLED = 1120
Y_MovingLED = 1121
Z_MovingLED = 1122

CurrXPos = GetOEMDRO(800)
CurrYPos = GetOEMDRO(801)
CurrZPos = GetOEMDRO(802)

If CurrXPos = IsActive(X) Then
   SetUserLED(X_MovingLED,1)
Else
   SetUserLED(X_MovingLED,0)
End If 

If CurrYPos = IsActive(Y) Then
   SetUserLED(Y_MovingLED,1)
Else
   SetUserLED(Y_MovingLED,0)
End If

If CurrZPos = IsActive(Z) Then
   SetUserLED(Z_MovingLED,1)
Else
   SetUserLED(Z_MovingLED,0)
End If
                     


X_MovingLED = 1120
Y_MovingLED = 1121
Z_MovingLED = 1122

CurrXPos = GetOEMDRO(800)
'OldXPos = GetUserDRO(2001)
CurrYPos = GetOEMDRO(801)
'OldYPos = GetUserDRO(2002)
CurrZPos = GetOEMDRO(802)
'OldZPos = GetUserDRO(2003)

If CurrXPos = IsActive(800) Then
   SetUserLED(X_MovingLED,1)
    'SetUserDRO(2001,CurrXPos)
Else
   SetUserLED(X_MovingLED,0)
    'SetUserDRO(2001,CurrXPos)
End If 

If CurrYPos = IsActive(801) Then
   SetUserLED(Y_MovingLED,1)
    'SetUserDRO(2002,CurrYPos)
Else
   SetUserLED(Y_MovingLED,0)
    'SetUserDRO(2002,CurrYPos)
End If

If CurrZPos = IsActive(802) Then
   SetUserLED(Z_MovingLED,1)
    'SetUserDRO(2003,CurrZPos)
Else
   SetUserLED(Z_MovingLED,0)
    'SetUserDRO(2003,CurrZPos)
End If
           
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #42 on: March 26, 2013, 09:50:36 AM »
trying 3 single scripts for each axis.
no worky

?_MovingLED = 112?

Curr?Pos = GetOEMDRO(800)
X = XY or Z

If CurrXPos = IsActive(800) Then
   SetUserLED(?_MovingLED,1)
 Else
   SetUserLED(?_MovingLED,0)
 End If 

just so ya'll know what i'm doing.
open mach3, menu Operator\VB Script Editor.
then running script from there.
« Last Edit: March 26, 2013, 09:57:20 AM by Kenneth »
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #43 on: March 26, 2013, 10:14:23 AM »
and does mach3 run ALL the scripts in c:\mach3\macros\userfolder  ?
Kenneth

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #44 on: March 26, 2013, 10:43:19 AM »
Kenneth, I think you are wanting leds assigned to each axis that turn on when that axis is moveing.  Is that correct?

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #45 on: March 26, 2013, 11:18:50 AM »
yes sir
Kenneth

Offline Chaoticone

*
  • *
  •  5,624 5,624
  • Precision Chaos
    • View Profile
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #46 on: March 26, 2013, 11:44:21 AM »
I dont see how you will ever do that in a button.  The script in a button runs once for each press unless the script tells it to run in an infinate loop which is not good.  The macro pump is like a button that runs roughly 10 times a second, brains are faster than that.

Brett
;D If you could see the things I have in my head, you would be laughing too. ;D

My guard dog is not what you need to worry about!
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #47 on: March 26, 2013, 12:01:55 PM »
Hi Kenneth,
   I've been watching this since you started. I'm no macro author so I could make no suggestions.
But, I did do as PoppaBear offered and with a slight typo correction, his scheme worked perfectly here.
I added 3 LED's, one beside each axis DRO and put the following in the pump. Seems to work like a charm.
If anything is moving, the associated LED is ON.

X_MovingLED = 1120
Y_MovingLED = 1121
Z_MovingLED = 1122
CurrXPos = GetOEMDRO(800)
OldXPos = GetUserDRO(2000)
CurrYPos = GetOEMDRO(801)
OldYPos = GetUserDRO(2001)
CurrZPos = GetOEMDRO(802)
OldZPos = GetUserDRO(2002)

If CurrXPos <> OldXPos Then
   SetUserLED(X_MovingLED,1)
   SetUserDRO(2000,CurrXPos)
Else
   SetUserLED(X_MovingLED,0)
   SetUserDRO(2000,CurrXPos)
End If

If CurrYPos <> OldYPos Then
   SetUserLED(Y_MovingLED,1)
   SetUserDRO(2001,CurrYPos)
Else
   SetUserLED(Y_MovingLED,0)
   SetUserDRO(2001,CurrYPos)
End If

If CurrZPos <> OldZPos Then
   SetUserLED(Z_MovingLED,1)
   SetUserDRO(2002,CurrZPos)
Else
   SetUserLED(Z_MovingLED,0)
   SetUserDRO(2002,CurrZPos)
End If  

I wish I could offer more and I hope I am understanding exactly what it is you are wanting.
Cheers,
Russ
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #48 on: March 26, 2013, 12:06:21 PM »
thanks, think that's my problem. i'm not using a pump, brain OR button :)
was just writing script and think it would run. i was thinking a script WAS a
pump. so how do i write one of these pump things ? :)
Thanks again Brett and Russ
Kenneth
Re: Terminate a brain with "run macro M650.m1s" ???????
« Reply #49 on: March 26, 2013, 12:09:57 PM »
In your M3 folder, open macros, choose the profile you are running, then open macropump.m1s.
Copy and past what I posted in there and save.
thats it.
all you need is the 3 user led's on your screen, the user dro's are invisible to you