Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: jevs on April 03, 2011, 09:06:03 PM
-
I have been fighting VB for hours.
How can I tell it to turn off the softlimits if they are on?
I am working on a tool change macro that has to move the Z axis out of it's soft limits.
DoOEMButton(119) will toggle it, but that does me no good if the macro executes while the softlimits happen to be off. If that happens then it just turns the soft limits back on and gives you a reset during the macro because you are out of soft limit area.
I need it to check if soft limits are on and then toggle them to off, but if they are already off do nothing
I have tried this:
SoftLimit = GetOEMLED(23)
If SoftLimit = 1 Then DoOEMButton(119)
It doesn't work
I have tried this:
If GetOEMLED(23) = 1 Then DoOEMButton(119)
That doesn't work either.
P.S. why in the heck does the window to type in a message always bounce up so you can't see what your typing on this stupid thing!
-
Oh if someone has a simple command to just turn soft limits off, that would be great also, but I cant find anything but toggle, which is lame.
-
Try:
If GetOEMled (23) Then
DoOEMButton (119)
End If
Works here,
Russ
-
............... has to move the Z axis out of it's soft limits.
Why do you not have the Soft Limits set up to include the entire range of the available Z travel ?
On mine, anything out of the Soft Limits will hit a Limit or crash into a hard stop.
Just curious,
Russ
-
If GetOEMled (23) Then
DoOEMButton (119)
End If
This seems to work, but how come no variable? It just assumes IF "on" Then? I guess if wanting to tell if it is off then you would do something like this-IF NOT GetOEMLED(23) Ten.......?
As for getting out of the softlimits......I don't want to be able to jog out of the "machinable" area when I am manually jogging the machine. So my softlimit is set at the home switch of Z which happens to be in the middle somewhere. Above this home switch tool change occurs. See the video here for better understanding. This was just a manual jog to show a tool change. I have the macro working now, I just have to get it counting the tools next and keeping track of which one it is on.
http://www.youtube.com/watch?v=W-0q5uM8jbU
-
Oh and there is a limit switch at the top of the tool change area and at the bottom of the z that are the hard limits in series tied to the Z limit input. So, it is still safe......
-
Don't know much about VB, just what I've seen in examples from others.
What you mention would probably work.
Good luck with the rest of it, plenty of examples around the forum for the tool change.
Russ
-
I'm still learning VB but I pulled this out of the script I use to do my homing, dont know if it will help but...
If CBool(GetOEMLED(MachSoftLimitsONLED)) Then
DoOEMButton(MachSoftlimitsToggle) 'Turns Soft Limits OFF(or Off)
End If
-
Thanks, I got my tool changer macro done, the previous posters method worked fine. You can see the code here if you want:
http://www.machsupport.com/forum/index.php/topic,18069.0.html
-
The reason "If GetOEMLED(23) = 1" doesn't work is because, while GetOEMLED(23) returns 0 for False, it returns -1 for True.
Also keep in mind that any non-zero value will likely evaluate to True. This becomes especially important if you are using Not.