Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 02:32:14 AM

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
| | |-+  More VBscript woes
Pages: 1 2 »   Go Down
Print
Author Topic: More VBscript woes  (Read 854 times)
0 Members and 1 Guest are viewing this topic.
M250cnc
Active Member

Offline Offline

Posts: 591




View Profile
« on: September 02, 2010, 05:16:56 AM »

This is copied from RayL's VB ref guide

RefCombination
Sub RefCombination(Axes As Integer)
This function allows any combination of axes to be simultaneously referenced (homed). Which axes will
be referenced is determined by the Axes argument, which is a bit-mapped variable, with the bits mapped
as defined below.
Arguments:
Axes is a bit-mapped value the defines which axes are to be referenced. The value of Axes can be
calculated by adding the values corresponding to the individual axes to be referenced. The axis
values are:
X = 1
Y = 2
Z = 4
A = 8
B = 16
C = 32
So, for example, to reference the X, Z and B axes, Axes = 1 + 4 + 16 = 21.
Return Value:
None
Example:
‘ Define some constants
RefX = 1
RefY = 2
RefZ = 4
RefZ = 8
RefB = 16
RefC = 32
‘ Reference Y, Z and C axes
RefCombination(RefY + RefZ + RefC)

So my code is

RefX=1
RefZ=4
RefCombination (5)

Only one axis moves (X) this on a lathe, current stable release i have individual home switches on different pins using a SS

So what the hell is wrong.  Huh
Logged

The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable
stirling
Global Moderator
*
Offline Offline

Posts: 1,108

UK


View Profile WWW
« Reply #1 on: September 02, 2010, 06:53:41 AM »

I use this all the time in Mill but also just tried it on Lathe and it works fine here. Maybe another SS issue?

BTW - how did your other button problem turn out?  Evil
Logged
M250cnc
Active Member

Offline Offline

Posts: 591




View Profile
« Reply #2 on: September 02, 2010, 07:01:03 AM »

I use this all the time in Mill but also just tried it on Lathe and it works fine here. Maybe another SS issue?

BTW - how did your other button problem turn out?  Evil

OK thought maybe it was me somehow, yeah the other button works great but i took the feed part out so it just runs at the current feedrate.

Thanks for the help
Logged

The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable
ger21
Global Moderator
*
Offline Offline

Posts: 2,470



View Profile WWW
« Reply #3 on: September 02, 2010, 07:38:08 AM »

You don't need the first part.
RefX=1
RefZ=4

All you need is RefCombination(5)
Logged

stirling
Global Moderator
*
Offline Offline

Posts: 1,108

UK


View Profile WWW
« Reply #4 on: September 02, 2010, 07:52:05 AM »

He he... I didn't point that out cos I thought people would think I was being picky - but it has no effect on the problem anyway - just two pointless (unused) variable decs and assignments. But whilst I'm being picky - the text in the guide is wrong anyway - they're not constants - they're variables.  There - got that off my chest - thanks Gerry Grin
Logged
M250cnc
Active Member

Offline Offline

Posts: 591




View Profile
« Reply #5 on: September 02, 2010, 08:54:23 AM »

Thanks guys, it's so nice to know that it doesn't work whether they are variables or constants unnecessary parts or whatever.  Angry  Roll Eyes
Logged

The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable
ger21
Global Moderator
*
Offline Offline

Posts: 2,470



View Profile WWW
« Reply #6 on: September 02, 2010, 10:49:47 AM »

I have a question, since I only pretend to be a programmer.Smiley

Wouldn't RefX be a variable, and 1 be the constant? And since the RefX is not needed, then the integers are constants? Smiley Maybe that's what he means?


Phil, do you get an error message, or does it just not work?

Does Dobutton(24) ref the Z?
Logged

M250cnc
Active Member

Offline Offline

Posts: 591




View Profile
« Reply #7 on: September 02, 2010, 11:08:33 AM »

Hi Gerry,

I have always been able to home each axis using the DoButton 22 & 24 if i remember correctly but one at a time.

When i first started playing with the combination only the Z referenced.

As i have it coded only the X axis is referenced with no error messages and i can step through the script from the edit button script no problem.

Logged

The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable
stirling
Global Moderator
*
Offline Offline

Posts: 1,108

UK


View Profile WWW
« Reply #8 on: September 02, 2010, 12:25:55 PM »

Phil

Can we start from scratch? When I look at the "Home All" button in lathe as it is out of the box, there is no VB in the button. Instead it uses OEM code 211. If you look up that in the OEM codes.xls file it says - Home X Home Z (turn). That seems to translate (after testing) to Home X THEN Home Z.

So - at some point I'm thinking you must have used a screen editor to change from using an OEM code to using VB - correct? (just trying to establish the full train of events)

Moving on. If I change from using an OEM code to using vbcode with:

doButton(24)
doButton(22)

Then it homes Z and then X

However, if I then change it to:

RefCombination(5)

It homes Z and X at the same time - i.e. what you want.

Two thoughts:

1) Can you try it using the parallel port driver and see what happens?
2) It's back to my thoughts that this may be an SS issue.

Meanwhile....

I have a question, since I only pretend to be a programmer.Smiley

Wouldn't RefX be a variable, and 1 be the constant? And since the RefX is not needed, then the integers are constants? Smiley Maybe that's what he means

What it says is:

Quote
‘ Define some constants
RefX = 1
RefY = 2
...etc...

So 1 indeed is a constant but that is not what's being defined - RefX is. Wink

We can do literal constants and symbolic constants if you like  Evil
« Last Edit: September 02, 2010, 12:51:50 PM by stirling » Logged
M250cnc
Active Member

Offline Offline

Posts: 591




View Profile
« Reply #9 on: September 02, 2010, 03:18:03 PM »

Phil

Can we start from scratch? When I look at the "Home All" button in lathe as it is out of the box, there is no VB in the button. Instead it uses OEM code 211. If you look up that in the OEM codes.xls file it says - Home X Home Z (turn). That seems to translate (after testing) to Home X THEN Home Z.

So - at some point I'm thinking you must have used a screen editor to change from using an OEM code to using VB - correct? (just trying to establish the full train of events)

Moving on. If I change from using an OEM code to using vbcode with:

doButton(24)
doButton(22)

Then it homes Z and then X

Yes you are exactly right, i have modified the standard sreen set and it worked as it should before i changed it ie sends each axis to the home position but i never used it.




However, if I then change it to:

RefCombination(5)

It homes Z and X at the same time - i.e. what you want.

Two thoughts:

1) Can you try it using the parallel port driver and see what happens?
2) It's back to my thoughts that this may be an SS issue.

Well it doesnt move both for me and i can't use the PP port, although my pc is a desktop not laptop.

At the end of the day i can find another use for that button i will just continue to ref one axis at a time
Logged

The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable
Pages: 1 2 »   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!