Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: budman68 on October 03, 2012, 07:10:31 PM

Title: Toggle axis jog control?
Post by: budman68 on October 03, 2012, 07:10:31 PM
Hi all,

I have a question for those of you that get VB scripting. I have a shuttle pro 2 controller and I'd like to consolidate some buttons into one button, if possible.

I have buttons setup for each axis but I was wondering if it was possible to have one button to just toggle through the 4 axes until I get to the one I want to jog?

Thanks for your time,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 03, 2012, 08:08:59 PM
Have you tried OemButton(1031)  "Jog Toggle" ?

IF there is no button for what you need to you will have to set a macro that toggles between the functions that work. Let us know if that is what you need.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 03, 2012, 08:11:58 PM
I will look at that Terry, thank you, and if that isn't it, I would love some help with the macro if needed.

Thanks again,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 03, 2012, 09:14:53 PM
Dave what function calls are being made with the current buttons?

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 10:31:22 AM
Hi Terry,

Ok, had a look at the OEM function 1031 and it didn't do anything at all for me?

The way I have it set up is like the picture below of the pendant I use. You can see the X,Y, and Z are chosen separately, and the screenshots are of the shuttle Pro config dialog box and you choose the functions though the drop down boxes.

If there's anything else you'd like or need to know, just give me a shout and I appreciate your time!
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 02:59:03 PM
Hiya Dave, When you make an axis selection (press Button) does it turn any of the axis leds on the jog flyout panel ? ANy of the MPG axis leds turn on  Trying to figure out how the pendant uses the functions.

Do you have any leds you monitor to see WHICH axis is Active for jogging?

SO IF I do a macro that toggles through the axis can it be applied to a button?

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 03:05:36 PM
Hi, Terry,

No sir, no LEDs, just a message in the standard message bar that says which axis has been selected for jogging. See screen shot below of my screenset in Mach mill.

Thanks,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 05:38:27 PM
Dave this is a simple example of a macro that can increment through a set of fuinctions. It runs through 4 functions and then repeats from the beginning. At each press of the button it updates the Mach status bar as to the function selected.

You can add in the FUNCTION code that makes it actually run the functions

If GetUserDro(1999) < 5 Then
   SetUserDro(1999,GetUserDro(1999)+1)
   End If
If GetUserDro(1999) >= 5 Then
   SetUserDro(1999,1)
   End If
   
If GetUserDro(1999) = 1 Then
   Message("Selecting X axis for Jogging")
   '(add function code here)   
   End If
If GetUserDro(1999) = 2 Then
   Message("Selecting Y axis for Jogging")
   '(add function code here)
   End If
If GetUserDro(1999) = 3 Then
   Message("Selecting Z axis for Jogging")
   '(add function code here)
   End If
If GetUserDro(1999) = 4 Then
   Message("Selecting A axis for Jogging")
   '(add function code here)
   End If

End

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 05:46:59 PM
Terry,

That worked at toggling the messages, but it only jogs the X axis?

Thanks,
Dave
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 05:50:20 PM
Ok, I think I misunderstood, it's actually doing exactly what you said it would do, and I have to figure out how to add in the functions, correct?

crap..... I have no clue what I'm doing with this, lol!  :D

I'll let you know how I make out!

Thanks again, my friend-
Dave
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 06:01:02 PM
Terry, where dod I find the codes for the standard "system functions" ? I looked through the OEM code list but nothing there was specific to choosing a certain axis?

Thanks,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 06:05:19 PM
(;-) THAT IS the $100 question as to which function they used to switch axis for the way they did it in the plugin.

We will just have to try a feww things and SEE if we get results. There are functions for MPG jogging and Encoder jogging and I think Joystick joggiing. ONE of them has to work(;-)

I would set up the editor and try each oembutton code to see IF it switches axis.

OR you could ask Art or the Coauthor of the plugin(;-)Easy way,

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 06:11:21 PM
Ok, will do sir, and thank you!

Dave
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 07:22:05 PM
Hi, Terry,

I given the codes that "could" work a try, but no luck at all. In fact, there was no sign of life at all. Am I supposed to keep the parenthesis? In other words, like this:

If GetUserDro(1999) = 1 Then
   Message("Selecting X axis for Jogging")
   '(188)

188 being the code for: Select A for MPG 1

I've tried it with and without the parenthesis but no luck either way.

Thanks,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 07:36:42 PM
(;-) AH no,

In that case it would be

If GetUserDro(1999) = 1 Then
   Message("Selecting X axis for Jogging")
   DoOemButton(188)
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 07:40:37 PM
duh........... I'm off to try again!
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 07:42:16 PM
For testing I would set the Axis from the device to say Y  then jog to make sure it jogs Y.   Then open the VB editor and run a line of code like

DoOemButton(188)

Then try to jog and see which axis moves. I would try all the code #'s  that involve X and jogging to find out WHICH one they used to switch the axis.
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 07:44:00 PM
exactly what I'm trying to do but it's getting late in the day for me and I'm getting sloppy and not doing these "intelligently".
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 07:44:46 PM
Nice looking pendant by the way, (;-)

If all else fails take a break and walk away from it for a while.

I will do some more snooping for ya.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 07:56:10 PM
Thanks, Terry.  :)
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 08:04:45 PM
OK I cheated and asked (;-) Scott S.

DoOemButton(185)  - 190    X - C

(;-) TP
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 08:08:03 PM
So it should go as the example BUT I am sure there are other ways it can be done


If GetUserDro(1999) < 5 Then
   SetUserDro(1999,GetUserDro(1999)+1)
   End If
If GetUserDro(1999) >= 5 Then
   SetUserDro(1999,1)
   End If
   
If GetUserDro(1999) = 1 Then
   Message("Selecting X axis for Jogging")
    DoOemButton(185)
   End If
If GetUserDro(1999) = 2 Then
   Message("Selecting Y axis for Jogging")
   DoOemButton(186)
   End If
If GetUserDro(1999) = 3 Then
   Message("Selecting Z axis for Jogging")
    DoOemButton(187)
   End If
If GetUserDro(1999) = 4 Then
   Message("Selecting A axis for Jogging")
    DoOemButton(188)
   End If

End
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 08:17:08 PM
I did too and he gave me the same numbers. Unfortunately that does not work  :-[

It keeps jogging only the X axis.
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 08:23:56 PM
Try the MPG#2 numbers then the encoder jog #s.   I do not have a shuttle here to test with(;-(.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 08:24:25 PM
Just heard back from Art and here's what he had to say:

Hi Dave:

 Wow..that ones been awhile... I dont believe you can do it with a function code. Seems to me I wrote the dropdowns as specific to the plugin. Its not a large change, but it woudl have to be done in the plugin itself as near as I remember. I dont think theres any system code attached to that plugins dropdowns.. and no code that specifically changes axis in a rotating fashion. I could be wrong, but I dont think I even have the original source for that plugin, Id have to do some research to find it. Can you compile a plugin or change one?

Art


Unfortunately plugin modification is above me  :(

Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 08:33:24 PM
Dave I believe that SCOTT had the plugin code  after Art did it to make MODs to it.

Try something. Open the jogging flyout(TAB)  and see if you can use the altA button to change the Axis. IF they used that method then there is a COde

OemButton(175) that toggles between xyzabc just like it does on the flyout screen.

(;-) TP

Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 08:38:01 PM
No luck on that one my friend-

I tried altb as well
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 08:45:25 PM
Did you make sure that on the flyout you had selected JOG MODE as MPG ?

Just thinking out loud, (;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 08:47:51 PM
errrmmmm....no. I had to hit Shuttle mode  ;D

Not that I did, I click the altA button and it says "end shuttle first" in the message bar.

I'm hittin the hay here shortly, but I do appreciate your help Terry.

Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 08:51:12 PM
OK I'll give it some more thought. DID you happen to change the buttons to NONE on the shuttle for the jog axis selection??

COuld be they used some magic monkey dust in the plugin to fool us mortals.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 04, 2012, 08:55:01 PM
Just tried it, Terry, and no luck there either. Appreciate the effort!

G'night-
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 04, 2012, 10:02:45 PM
So it seems that when Art did the plugin he locked out all outside functions as LONG as the plugin was active.

HUM, I'll have to think on that one.

Maybe Scott has an idea.

DAVE(;-) WHICH plugin are YOU running?

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 05, 2012, 04:59:15 AM
Good morning, Terry,

Here's the thread where Scott starting playing around with it. It went through a couple of revisions, but the version in reply #9 is the one I believe I'm using.

The info in reply #2 may be helpful?

http://www.machsupport.com/forum/index.php/topic,12163.0.html

Thanks,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 05, 2012, 12:08:17 PM
Dave Are you trying the macro from inside the shuttle plugin or outside via CB editor. Could be IF you ran it from inside the shuttle it might  work ?

Just a thought, (;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 05, 2012, 12:31:31 PM
Tried it both ways using a script through the shuttle and a button on the screen as well.

Thanks,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 05, 2012, 12:46:23 PM
Dang Dave,  Are you trying to be difficult ? (;-)

I'll keep pecking away at it, (;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 05, 2012, 01:19:06 PM
lol! Yes, I have nothing better to do than play with your mind   ;D

Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 05, 2012, 03:05:11 PM
Playing with MY mind is fun it is basically a box of rocks.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 05, 2012, 03:13:15 PM
Well your rocks are a lot sharper than mine!  ;)

Dave-
Title: Re: Toggle axis jog control?
Post by: budman68 on October 05, 2012, 04:39:44 PM
Terry, I spoke with someone about this and we're starting to think it may not be do-able unless a new plugin is written to add this.

It sounds probable, but I truly appreciate the effort, time and help you put into it.

Now, to find someone that may know how to write/update a plugin,  :D

Thank you
Dave
Title: Re: Toggle axis jog control?
Post by: poppabear on October 05, 2012, 10:27:18 PM
Dave,

    I will look into the plugin....  But, the issue may be deeper than that...
The Shift Jog axis OEM codes, (IF... memory serves and it may not), work only IF
you have a real MPG hooked to the PP interface......

I will look and see if I can write and override that..... but just remember if your running,
PP or other motion plugin, an external REAL MPG may override that function...

Terry,

     Send me the VB Macro file you did, for cycling the job axis, so I don't have to re-invent that wheel.

Scott
Title: Re: Toggle axis jog control?
Post by: poppabear on October 06, 2012, 01:13:54 AM
Dave,

Here is a link to the BETA!!!!  SP2 v. 2.7 with the cycle jog axis, it is under finished plugins....

http://www.machsupport.com/forum/index.php/topic,22600.new.html#new

PLEASE read that post, and let me know your findings in THAT thread since it will be plugin related.

Scott
Title: Re: Toggle axis jog control?
Post by: budman68 on October 06, 2012, 06:30:02 AM
I posted in your new thread, Scott

Thank you,
Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 06, 2012, 10:26:41 AM
Dave, As a shot in the dark could you try this macro from inside the shuttle . Apply it to a button.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 06, 2012, 11:11:57 AM
Gave it a shot, my friend, and nothing happens at all, not even any messages in the status bar about the axis being selected.

Also tried it with a VB button on a screen just for the heck of it, and nothing as well.

Dave
Title: Re: Toggle axis jog control?
Post by: BR549 on October 06, 2012, 11:18:15 AM
It was just a shot in the dark(;-)

(;-) TP
Title: Re: Toggle axis jog control?
Post by: BR549 on October 06, 2012, 01:52:41 PM
DAVE I had hoped that Art had left some hooks into the real world of Mach3 when he created the plugin BUT he did not(;-).

I can see where Scott might  modify the source code but that will be up to him on how he approaches it.

(;-) TP
Title: Re: Toggle axis jog control?
Post by: budman68 on October 06, 2012, 04:37:05 PM
Just to update, Scott is done with this as he would need a Shuttle Pro 2 to work on it.

Thanks again for the effort all,
Dave