1
VB and the development of wizards / 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
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