Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: Saumur on April 24, 2009, 09:42:10 AM
-
Guys, I wanted to know if there is an option that doesn't allow you to start an automatic cycle if the light box of the home axis didn't turn green.
As you know the home axis light is red untill you do the home and then turn green.
In other words I'd like to know if yo can choose to block the automatic movement in case the lights( both of them) didn't turn green.
Thanks
-
You could probably replace the Start button with a VB one and have something like this in the button.
If GetOemLED(807) Or GetOemLED(808) Or GetOemLED(809) Then
DoOemButton(1003)
Sleep (100)
MsgBox("Axis not referenced")
Else
DoOemButton(1000)
End If
-
Thanks for your fast answer,
from what I understand you can create a VB button and then set it so it sayr error if the lights are not green.
If that is right can you tell me how can I do that?
Thanks again
-
Open the screen in Screen4, right click on the button, and set it to VB script. In Mach3, under Operator menu, choose select button script. Click the button, and the script editor will open, allowing you to add the script to the button.
-
Thanks for your reply.
One last thing: To open the screen with screen4 do I need a program? if yes where can I download it?
Sorry but I'm a nub on this.
Thanks and regards
-
You find screen4 in the download section here.
-
Guys with your help I could do that,
the only problem is that if I put what Hood said it says "terminating script" when I press on Cycle start.
It says the same thingh even if the home lights are green.
Can some1 confirm me if what Hood said to put is right?
Thanks again
-
Not tried it myself but I will go and do it.
Hood
-
Just tried it and seems to work fine.
Did you copy and paste the code into the button?
Have you checked to make sure it has saved in the button as sometimes the VB buttons dont save.
Does it work from the Edit VB Button window if you press the green arrow?
Hood
-
Thanks for your help Hood,
Anyway if I try using it with the play arrow in the VB edit the message "Axis not referenced" pops out.
Have you any idea what I'm doing wrong?
Anyway in the input option I didn't put the green arrow on the homes since I'm testing this on a laptop.
That could be the problem? If yes what I have to put to test it?
Thanks for your help
-
You should be getting that message if your axis are NOT homed, if they are homed then you should not get the message. If you are wanting to simulate the axis being homed then disable the Home switches in Ports and Pins, Inputs and then press the Ref All button, the LEDs should turn green and when you press the arrow in the VB Editor the code should start.
If I am misunderstanding what you are wanting please let me know.
Hood
-
Hood,
you understood perfectly what I'm trying to do.
The problems is that even if the leds are green the message I told you pops up.
Just to let you know I put this code :
If GetOemLED(807) Or GetOemLED(808) Or GetOemLED(809) Then
DoOemButton(1003)
Sleep (100)
MsgBox("Axis not referenced")
Else
DoOemButton(1000)
End If
In the cycle start button.
I donĀ“t get why it works for you. I don't know if it matters but I use Mach3 for lathe and I use axes X and Z
If there's something wrong please tell me.
Thanks a lot for your patience
-
Ah OK sorry, the reason you get that message is that you dont have a Y axis because its a lathe, my fault sorry :(
Ok put this in the button.
If GetOemLED(807) Or GetOemLED(809) Then
DoOemButton(1003)
Sleep (100)
MsgBox("Axis not referenced")
Else
DoOemButton(1000)
End If
-
Dear Hood,
the last thing you should be is sorry since now it is working. :P
Thanks again for your patience and help.
See you
-
What is the meaning with the line: "Sleep (100)"?
-
it just gives a 1/10 of a second pause before the VB code will continue to the next line, it may not be needed in reality but I just prefer to have it in there.
Hood
-
Saumur
Glad its working, if only I had read your initial post properly it would have been correct from the start :)
Hood
-
Ok, thanks Hood :)
-
Hey Guys,
I'm bringing up this cause I'm trying to do this work on a computer but when I'm in Screen4 if I right click on a button it doesn't allow me to change it to VB script; I right click and nothing happens.
Anyone knows why?
Thanks
-
Try a double left click on the button.
Hood
-
thanks mate