Hello Guest it is October 31, 2024, 07:53:42 PM

Author Topic: SlowJogRate ofer Hotykey ? How can help me?  (Read 11316 times)

0 Members and 1 Guest are viewing this topic.

SlowJogRate ofer Hotykey ? How can help me?
« on: December 19, 2007, 07:29:54 AM »
Hi I my Ronny,

and i have a big problem.
First, sorry for me english, it is very well.

I want right a VB-Script vor me Mach3.
I have thinking me something and then
i right this:


If Hotkey (F5) incoming Then

SetOEMDRO (3,100)
X=GetOEMDRO (3)
MsgBox X

Else
End


If Hotkey (F6) incoming Then

SetOEMDRO (3,20)
X=GetOEMDRO (3)
MsgBox X

Else
End

If Hotkey (F7) incoming Then

SetOEMDRO (3,2)
X=GetOEMDRO (3)
MsgBox X

Else
End



Me Problem is, i dont know that i must right for "Hotkey (F7) incoming".
I whant do this

SetOEMDRO (3,2)
X=GetOEMDRO (3)
MsgBox X

if Hotkey (F7) is presst.
Can somebody help me ?
And pleas right very short and understandle.
Thanks a lot.

Ronny

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • www.razordance.co.uk
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #1 on: December 19, 2007, 10:40:11 AM »
hi Ronny

There are sure to be other ways to do what you want but here's one...

you need screen designer http://www.machsupport.com/Downloads/Mach3Screen.zip

1) load c:\mach3\1024.set
2) add a button (see one.jpg)
3) double click the new button
4) edit the button script (see two.jpg)

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #2 on: December 19, 2007, 11:18:23 AM »
Ronny,

Here is the way to do it, the way your wanting to:

Goto Config>ports and pins>input tab:
Enable Input1, Input2 and Input3 leave the port/pin at 0/0, put a check in emulate, then set your hot key for Input 1, 2, and 3 to f5, f6, f7
leave an X in active low. Hit apply, then ok.

goto operator>VB  scripter, open it and paste in the following, then goto File>save as and put the file name as: "Macropump.m1s", close the window (make sure that the macropump is saved in the macro folder for your profile).

'Macropump.m1s

a=GetUserDRO(2000)
b=GetUserDRO(2001)
c=GetUserDRO(2002)


If IsActive(INPUT1) And a=0 Then
SetOEMDRO(3,100)
x=GetOEMDRO(3)
SetUserDRO(2000,1)
Message("Slow Jog Rate set to 3")
Else
SetUserDRO(2000,0)
End If

If IsActive(INPUT2) Then
SetOEMDRO (3,20)
y=GetOEMDRO(3)
SetUserDRO(2001,1)
Message("Slow Jog Rate set to 20")
Else
SetUserDRO(2001,0)
End If

If IsActive(INPUT3) Then
SetOEMDRO (3,2)
z=GetOEMDRO (3)
SetUserDRO(2002,1)
Message("Slow Jog Rate set to 2")
Else
SetUserDRO(2003,0)
End If   


Then: goto config>general and check the enable macropump, hit ok then close and re-open Mach.

now when you hit the f5, f6, or f7 keys you will see a message scroll across the bottom that shows what your slow jog % rate is.
You can also watch the dro itself by hitting the tab key and looking at the slow jog rate % DRO.

scott

fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • www.razordance.co.uk
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #3 on: December 19, 2007, 12:55:18 PM »
Hi scott - interesting way of doing it and I'll forgive your little poke... ;D
the way your wanting to:

It's taught me what the macropump macro can be used for so thanks for that - however a couple of questions...

what's the userdro stuff for in your code? - I've studied it and can't see that it does anything at all. Also the x variable seems redundant.

here's mine based on yours which seems to do the same thing but maybe I'm missing something

'Macropump.m1s

If IsActive(INPUT1) Then
SetOEMDRO(3,100)
Message("Slow Jog Rate set to 100")
End If

If IsActive(INPUT2) Then
SetOEMDRO (3,20)
Message("Slow Jog Rate set to 20")
End If

If IsActive(INPUT3) Then
SetOEMDRO (3,2)
Message("Slow Jog Rate set to 2")
End If


Cheers

Ian

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #4 on: December 19, 2007, 02:59:22 PM »
Ian,

   sorry my reply wasnt meant to poke at you, I read it myself and it does come across that way, I am sorry. I should have read before I posted.

ON to the Macropump:
I forgot to remove the X=dros stuff, I tried the msgbox in the macro pump and it was a bad, bad, bad idea.........
so I changed it to message.

The DROs act as Interlocks so that the code only executes Once while the button is held down, (no human finger can release faster than the macropump can come around and scan it a few times). Since the macro pump runs in a continous loop this stops it from "Pushing a button" or executing some command every scan if you only want the command to execute once per scan..........

scott
fun times

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #5 on: December 19, 2007, 03:02:33 PM »
corrected macropump code (without the extra garbage)

'Macropump.m1s

a=GetUserDRO(2000)
b=GetUserDRO(2001)
c=GetUserDRO(2002)


If IsActive(INPUT1) And a=0 Then
SetOEMDRO(3,100)
SetUserDRO(2000,1)
Message("Slow Jog Rate set to 3")
Else
SetUserDRO(2000,0)
End If

If IsActive(INPUT2) Then
SetOEMDRO (3,20)
SetUserDRO(2001,1)
Message("Slow Jog Rate set to 20")
Else
SetUserDRO(2001,0)
End If

If IsActive(INPUT3) Then
SetOEMDRO (3,2)
SetUserDRO(2002,1)
Message("Slow Jog Rate set to 2")
Else
SetUserDRO(2003,0)
End If   
fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • www.razordance.co.uk
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #6 on: December 20, 2007, 03:55:00 AM »
Hey scott - no problem - I was feigning offence - twas just a bit of fun. ;D

Thanks for the explanation - got it now.

Cheers

Ian
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #7 on: December 20, 2007, 07:04:54 AM »
Hi,

thanks a lot for your Help. This is a great Forum whis very nice people !
Me Mach is running  ;D This is gread!

Thank
Ronny

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #8 on: December 20, 2007, 08:42:04 AM »
opps spotted another typo error....

'Macropump.m1s

a=GetUserDRO(2000)
b=GetUserDRO(2001)
c=GetUserDRO(2002)


If IsActive(INPUT1) And a=0 Then
SetOEMDRO(3,100)
SetUserDRO(2000,1)
Message("Slow Jog Rate set to 3")
Else
SetUserDRO(2000,0)
End If

If IsActive(INPUT2) Then
SetOEMDRO (3,20)
SetUserDRO(2001,1)
Message("Slow Jog Rate set to 20")
Else
SetUserDRO(2001,0)
End If

If IsActive(INPUT3) Then
SetOEMDRO (3,2)
SetUserDRO(2002,1)
Message("Slow Jog Rate set to 2")
Else
SetUserDRO(2002,0)
End If   
fun times

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • www.razordance.co.uk
Re: SlowJogRate ofer Hotykey ? How can help me?
« Reply #9 on: December 20, 2007, 11:15:05 AM »
Hi Scott - sorry, me again  :)

shouldn't it be...

'Macropump.m1s

a=GetUserDRO(2000)
b=GetUserDRO(2001)
c=GetUserDRO(2002)


If IsActive(INPUT1) And a=0 Then
SetOEMDRO(3,100)
SetUserDRO(2000,1)
Message("Slow Jog Rate set to 100")
Else
SetUserDRO(2000,0)
End If

If IsActive(INPUT2) And b=0 Then
SetOEMDRO (3,20)
SetUserDRO(2001,1)
Message("Slow Jog Rate set to 20")
Else
SetUserDRO(2001,0)
End If

If IsActive(INPUT3) And c=0 Then
SetOEMDRO (3,2)
SetUserDRO(2002,1)
Message("Slow Jog Rate set to 2")
Else
SetUserDRO(2002,0)
End If