Hello Guest it is March 28, 2024, 06:33:21 AM

Author Topic: Tool Changer Timed Out as safety  (Read 2661 times)

0 Members and 1 Guest are viewing this topic.

Offline nso

*
  •  36 36
    • View Profile
Tool Changer Timed Out as safety
« on: October 18, 2015, 03:56:10 PM »
hi everyone
i need to add a macro as( time out) also i have tried to write something but that isn't worked...anyway i need to help


'ToolChange Macro For milling machine (liner type)
Sub Main()

OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
tool = GetSelectedTool()
NewTool = tool
'Tool Changer Macro (Bed Type)
MaxToolNum = 2      'Max number off tools for the changer
ToolDown   = -60 'Z Pos to Get or drop a tool
ToolUp     = 0   'Z Hieght to Rapid from tool to tool
If NewTool = OldTool Then
   Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
Code "G00 G53 Z" & ToolUp
While IsMoving()
Wend
Call MovePos(OldTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P.1"
While IsMoving()
Wend
Do                                                 'Start loop
ActivateSignal(Output2)                   'This is signal to activate  drawbar
If IsActive (Input1) Then Exit Do        'This is a  signal to say drawbar has released
Loop
Code "G53 Z" & ToolUp
Call MovePos(NewTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P.1"
While IsMoving()
Wend
DeActivateSignal(Output2) 'Turn Off Draw bar to Clamp the tool
Code "G4 P4.1"    'Wait for the tool to Clamp
While IsMoving()
Wend
============================================
its good but i think not enough ,i need something like this: if (input 2 ) not active after a time (10 ms) then show a (msgbox "tool isn't locked "   ) then active (emergency )
Do                                                 'Start loop
If IsActive (Input2)  Then  Exit Do      'This is a signal to say tool locked correctly
Loop


===========================
Code "G53 Z" & ToolUp
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
End Sub

Sub MovePos(ByVal ToolNumber As Integer)

Select Case ToolNumber
       Case Is = 1
         Xpos = 10
         YPos = 10
       Case Is = 2
         Xpos = 20
         YPos = 20
   
End Select

Code "G53 X" & XPos & " Y" & YPos
End Sub
Main       

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Tool Changer Timed Out as safety
« Reply #1 on: October 18, 2015, 04:42:17 PM »

Lcnt = 0        ' Set loop Counter to Zero

Do   while   isactive( input2)  = false       'Start loop
Lcnt = (Lcnt+1)                                  ' Add to counter
If Lcnt >= 1000 then                           ' Check for max count, if then do
DoButton(3)
MsgBox(" Tool Change Timed Out ")       ' Notify Operator  Or use Message" Tool Changer timed out" to write to the status line
END
End if

Loop

Offline nso

*
  •  36 36
    • View Profile
Re: Tool Changer Timed Out as safety
« Reply #2 on: October 19, 2015, 12:00:09 AM »
thanks a million dear BR549,that was what i need exactly also worked great   :)

'ToolChange Macro For milling machine (liner type)
Sub Main()
OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
tool = GetSelectedTool()
NewTool = tool
'Tool Changer Macro (Bed Type)
MaxToolNum = 2      'Max number off tools for the changer
ToolDown   = -60 'Z Pos to Get or drop a tool
ToolUp     = 0   'Z Hieght to Rapid from tool to tool
If NewTool = OldTool Then
   Exit Sub
End If
While NewTool > MaxToolNum
NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)
Wend
Code "G00 G53 Z" & ToolUp
While IsMoving()
Wend
Call MovePos(OldTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P.01"
While IsMoving()
Wend
=========================================
just for make sure the input 1 worked rightly at defined time because sometime the air pressure might isn't enough  so, i tried to do something like that here but didn't work    :-\
Do                                                 'Start loop
ActivateSignal(Output2)                   'This is signal to activate your drawbar
If IsActive (Input1) Then Exit Do        'This is your  signal to say drawbar has released
Loop
=======================================
Code "G53 Z" & ToolUp
Call MovePos(NewTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown
Code "G4 P.01"
While IsMoving()
Wend
DeActivateSignal(Output2) 'Turn Off Draw bar to Clamp the tool
Code "G4 P4.01"    'Wait for the tool to Clamp
While IsMoving()
Wend
Lcnt = 0        ' Set loop Counter to Zero

Do   While   isactive( input2)  = false       'Start loop
Lcnt = (Lcnt+1)                                  ' Add to counter
If Lcnt >= 1000 Then                           ' Check for max count, if then do
DooemButton(1021)
MsgBox(" Tool Change Timed Out/ tool isn't clamped correctly")       ' Notify Operator  Or use Message" Tool Changer timed out" to write to the status line
End
End If

Loop
Code "G53 Z" & ToolUp
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
End Sub

Sub MovePos(ByVal ToolNumber As Integer)

Select Case ToolNumber
       Case Is = 1
         Xpos = 10
         YPos = 10
       Case Is = 2
         Xpos = 20
         YPos = 20
  
End Select

Code "G53 X" & XPos & " Y" & YPos
End Sub
Main    

          
« Last Edit: October 19, 2015, 12:09:43 AM by nso »