Hello Guest it is April 26, 2024, 12:16:29 PM

Author Topic: Switching T1 & T2 via button  (Read 4132 times)

0 Members and 1 Guest are viewing this topic.

Switching T1 & T2 via button
« on: June 24, 2008, 07:34:11 PM »
Hello,
I was asking if it's possible to put a button into the main screen which switches between 2 tools instead of typing M6T1 & M6T2 into the MDI command line?

Regards,
Dejan

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Switching T1 & T2 via button
« Reply #1 on: June 24, 2008, 08:31:33 PM »
Yes there is, I will give you Two ways, one fixed the other user adjustable.

Fancy first:

 Drop two user DROs on your Screen in screen designer, I.e. DRO 2000, and 2001
also drop a button label it tool change.
Drop TWO user LEDs (one by each Tool DRO above, label them ToolA, and
ToolB for instance), Use User LEDs 1500, and 1501
set UserLED 1500 next to the DRO 2000, and put UserLED 1501 next to DRO2001.

In the button put this script:

'*********start of button script**********

CurrentChoice = GetUserLED(1500)
ToolA=GetUserDRO(2000)
ToolB=GetUserDRO(2001)

If CurrentChoice then
SetUserLED(1500,0)
SetUserLED(1501,1)
Code "T" & ToolB & "M6"
Else
SetUserLED(1500,1)
SetUserLED(1501,0)
Code "T" & ToolA & "M6"
End IF

'*************End of button script*******

NON-Fancy (hard coded Tool call)
as above, but just drop ONE LED on the Screen and one button, (or tWO leds if you want labels by them to tell what tool is current.

IN a button put this code:

'*********start of button script**********
CurrentChoice = GetUserLED(1500)

If CurrentChoice then
SetUserLED(1500,0)
SetUserLED(1501,1) 'if your using two leds
Code "T1M6"
Else
SetUserLED(1500,1)
SetUserLED(1501,0) 'if your using two leds
Code "T2M6"
End IF


'*************End of button script*******

'hope this helps,
'scott
fun times
Re: Switching T1 & T2 via button
« Reply #2 on: June 25, 2008, 03:27:01 AM »
Hello Scott,
Thanks a lot. I have implemented 2nd code, it works. The only one thing missing is to prevent tool change while in reset and while the program is running. also I would like to change tool number displayed at existing the Current Tool Number DRO. And to release the tools when hit reset... Sorry for bothering, but this time I really need help :-)

Cheers,
Dejan

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Switching T1 & T2 via button
« Reply #3 on: June 25, 2008, 08:14:51 AM »
First I dont understand a few of your statements:

1).  "The only one thing missing is to prevent tool change while in reset and while
the program is running"

This doesnt make since to me, because when you are in a Reset condition, you cant
run a M6 or any other code.

I can put a "Lock out" in the code below, so that if you are running a part and
you push the tool change button, that it will NOT execute........
But currently, if you code is running, and you have the
"Stop spindle and wait for cycle" Tick mark, ticked under your Config>Gen
Then even if that button is pressed, it stops your code running, and updates the
the tool DRO. So below, I will assume you want the button "Deactivated" if code is
presently running, if that is wrong then clairify your request.

ALSO: clairify what your concern is on the Reset condition...........

2).  "also I would like to change tool number displayed at
existing the Current Tool Number DRO."


The Tool DRO already Updates to the Tool Number when you press the button that
you added for changing between tool1 and tool2, SO, I dont understand what your
saying since, when you push the toolchange button, the ToolDRO updates..... to
the tool that you flipped to.

3).  "And to release the tools when hit reset... Sorry for bothering,
but this time I really need help :-)"

So if I understand this correctly, you want the Tool DRO (current tool), to goto
tool "0" when you hit the Reset button?
If that is correct I have modified the code below to do that.

CODE CHANGES:

1). Implemented that if the Code is currently running, that this button (Tool change button),  will
disable.

2). Change code in "RESET" button, that when you push E-Stop/Reset Button, The Current Tool Number DRO will
Display "0".

NOTE:  You will need to open up screen designer again, and add the code below to the "Tool Change" button.
You will also need to go to the "Park/Permenant" page of screen desiner to edit the Reset Button, the code
and procedure for that is below the Tool button script.


'*********start of button script**********

CurrentChoice = GetUserLED(1500)

If Not(GetOEMLED(804)) Then
If CurrentChoice Then
SetUserLED(1500,0)
SetUserLED(1501,1) 'if your using two leds if not remove this
Code "T1M6"
Else
SetUserLED(1500,1)
SetUserLED(1501,0) 'if your using two leds if not remove this
Code "T2M6"
End If
Else
Message("Stop machine running 1st")
End If

'*************End of button script*******

Reset Button Code Change so that when it is pushed your Tool DRO goes to "0"
NOTE: In screen designer 3 or 4, you will have to tick, the Execute VB script tick
button and put the below code in the box if using 3, save the screen open mach, and hit
view>load screen and load the one you just did.

in screen 4 tick the execute VB in mach3, and save.
you will need to open mach and load your changed screen, DONT reset yet, click
Operator>Edit Button script, your "Reset" button should start blinking, click on it
a VB window will open, put the script below in it, and hit SAVE on the VB window.
Close the VB window. Then hit View>Save Current Layout.
Also before going any further, open the button script again as above, sometimes the
VB doesnt stay, if not redo the above, and recheck again.
If you see the new code in the button, then that is good, just close the VB editor.

Now push your reset button, you will see your Tool DRO goto 0 (unless there already)

Inside the "Reset" button put this code:

'***start RESET button code******

SetOEMDRO(824,0)
DoOEMButton(1021)

'***end RESET button code*****

'Hope this fixes you up,
'scott
« Last Edit: June 25, 2008, 08:22:10 AM by poppabear »
fun times