Adding new tool locations - tool changer M6start VB script editor in mach 3
Gday, first of all, thanks in advance. For someone handy with script this is a simple thing, I am not handy with script!
The guy who made my CNC has written this script for the tool changer which has tool forks mounted along the Y axis (which all work) , however I've added a new rack of tools along the Y axis.
When I add the new tool positions, the machine can pickup the new tool, however the script makes the machine remove it from the hook/clamp/fork moving along the X axis, however the new tools need to move along the Y to load & unload
'ToolChange Macro For Bed type tool changer 11/05 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 ) a = GetToolChangeStart( 3 ) b = GetToolChangeStart( 4 ) c = GetToolChangeStart( 5 )
tool = GetSelectedTool() NewTool = tool 'Tool Changer Macro (Bed Type) MaxToolNum = 7 'Max number of tools for the changer ToolDown = -153.8 'Z Pos to Get or drop a tool (NOT USED) ToolUp = -80. 'Z Hieght to Rapid from tool to tool If NewTool = OldTool Then Exit Sub End If
While OldTool < 1 OldTool = 1 Wend
While NewTool > MaxToolNum NewTool = Question ("Enter New Tool Number up to " & MaxToolNum) Wend Code "G90" Code "M05" Code "G00 G53 Z-5.0" Code "G00 G53 X60.0" While IsMoving() Wend Call MovePosPrep(OldTool) While IsMoving() Wend
Code "G4 P1" Code "G01" Code "G91 X-50.0 F600." Code "G4 P1" Code "G90" While IsMoving() Wend ActivateSignal(Output2) 'Turn On Draw bar to release the tool Code "G4 P4" 'Wait for the tool to release 'SystemWaitFor (7) 'Wait for the tool Release Limit switch Code "G00 G53 Z" & ToolUp Call MovePos(NewTool) While IsMoving() Wend
Code "G4 P1" While IsMoving() Wend DeActivateSignal(Output2) 'Turn Off Draw bar to Clamp the tool Code "G4 P4" 'Wait for the tool to Clamp Code "G01" Code "G91 X50.0 F600." While IsMoving() Wend Code "G90" Code "G00 G53 Z" & ToolUp While IsMoving() Wend Call SetUserDRO (1200,NewTool) SetCurrentTool( NewTool ) Code "G90" Code "G00 G53 Z-5.0" Code "G43 H" & NewTool While IsMoving() Wend
End Sub
Sub MovePosPrep(ByVal ToolNumber As Integer)
Select Case ToolNumber Case Is = 1 Xpos = 52.80 YPos = 314.50 ZPos = -155.1 Case Is = 2 Xpos = 53.30 YPos = 475.00 ZPos = -155.4 Case Is = 3 Xpos = 52.80 YPos = 633.80 ZPos = -155.00 Case Is = 4 Xpos = 51.80 YPos = 793.80 ZPos = -155.20 Case Is = 5 Xpos = 52.10 YPos = 953.90 ZPos = -154.70 Case Is = 6 Xpos = 52.90 YPos = 1114.60 ZPos = -155.90 Case Is = 7 Xpos = 52.90 YPos = 10 ZPos = -155.90
End Select
Code "G53 X" & XPos & " Y" & YPos Code "G53 Z" & ZPos End Sub
Sub MovePos(ByVal ToolNumber As Integer)
Select Case ToolNumber Case Is = 1 Xpos = 2.80 YPos = 314.50 ZPos = -155.10 Case Is = 2 Xpos = 3.30 YPos = 475.00 ZPos = -155.40 Case Is = 3 Xpos = 2.80 YPos = 633.80 ZPos = -155.00 Case Is = 4 Xpos = 1.80 YPos = 793.80 ZPos = -155.20 Case Is = 5 Xpos = 2.10 YPos = 953.90 ZPos = -154.70 Case Is = 6 Xpos = 2.90 YPos = 1114.60 ZPos = -155.90 Case Is = 7 Xpos = 2.90 YPos = 10 ZPos = -155.90
End Select
Code "G53 X" & XPos & " Y" & YPos Code "G53 Z" & ZPos End Sub