Hello Guest it is November 14, 2019, 11:01:01 AM

Author Topic: Turn off soft limits in macro.....  (Read 4497 times)

0 Members and 1 Guest are viewing this topic.

Offline jevs

*
  •  306 306
    • View Profile
Turn off soft limits in macro.....
« 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!   

Offline jevs

*
  •  306 306
    • View Profile
Re: Turn off soft limits in macro.....
« Reply #1 on: April 03, 2011, 09:08:46 PM »
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.
Re: Turn off soft limits in macro.....
« Reply #2 on: April 03, 2011, 09:23:57 PM »
Try:

If GetOEMled (23) Then
DoOEMButton (119)
End If

Works here,
Russ
Re: Turn off soft limits in macro.....
« Reply #3 on: April 03, 2011, 10:00:01 PM »
............... 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

Offline jevs

*
  •  306 306
    • View Profile
Re: Turn off soft limits in macro.....
« Reply #4 on: April 03, 2011, 10:17:26 PM »

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

Offline jevs

*
  •  306 306
    • View Profile
Re: Turn off soft limits in macro.....
« Reply #5 on: April 03, 2011, 10:19:13 PM »
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......
Re: Turn off soft limits in macro.....
« Reply #6 on: April 03, 2011, 10:33:56 PM »
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

andrewm

*
Re: Turn off soft limits in macro.....
« Reply #7 on: April 06, 2011, 01:49:15 PM »
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

Offline jevs

*
  •  306 306
    • View Profile
Re: Turn off soft limits in macro.....
« Reply #8 on: April 06, 2011, 02:28:14 PM »
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

Re: Turn off soft limits in macro.....
« Reply #9 on: May 15, 2019, 07:31:45 PM »
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.