Hello Guest it is April 19, 2024, 01:51:52 AM

Author Topic: More VBscript woes  (Read 8326 times)

0 Members and 1 Guest are viewing this topic.

More VBscript woes
« on: September 02, 2010, 06: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.  ???
The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: More VBscript woes
« Reply #1 on: September 02, 2010, 07: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?  >:D
Re: More VBscript woes
« Reply #2 on: September 02, 2010, 08: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?  >:D

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
The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: More VBscript woes
« Reply #3 on: September 02, 2010, 08:38:08 AM »
You don't need the first part.
RefX=1
RefZ=4

All you need is RefCombination(5)
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: More VBscript woes
« Reply #4 on: September 02, 2010, 08: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 ;D
Re: More VBscript woes
« Reply #5 on: September 02, 2010, 09: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.  >:(  ::)
The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: More VBscript woes
« Reply #6 on: September 02, 2010, 11:49:47 AM »
I have a question, since I only pretend to be a programmer.:)

Wouldn't RefX be a variable, and 1 be the constant? And since the RefX is not needed, then the integers are constants? :) 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?
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: More VBscript woes
« Reply #7 on: September 02, 2010, 12:08:33 PM »
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.

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

The Bad Thing About Mach3, Is It's Too Configurable

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: More VBscript woes
« Reply #8 on: September 02, 2010, 01: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.:)

Wouldn't RefX be a variable, and 1 be the constant? And since the RefX is not needed, then the integers are constants? :) 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. ;)

We can do literal constants and symbolic constants if you like  >:D
« Last Edit: September 02, 2010, 01:51:50 PM by stirling »
Re: More VBscript woes
« Reply #9 on: September 02, 2010, 04: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
The Good Thing About Mach3, Is It's very Configurable

The Bad Thing About Mach3, Is It's Too Configurable