Greetings, Mach Fans!
I am working on a tool change macro for a Gantry style CNC router with a tool rack. I started with Brian's tool change macro, and tried to build upon it. I finally go it to do the correct motions I need. Will need some further configuration of outputs, dwell times, and speeds. I wanted to run this past the experts, and see if anyone has any tips on how do do this more efficiently.
I am including a picture of my non-standard tool grip configuration, to explain some (not all) of my madness. I will have two spindles mounted to the Z carriage, fixed relative to each other. Tool change will be simultaneous for both spindles, and they will be operating with identical tools (mass production... yay!) By positioning/spacing the tools on a rack this way, I will be saving space, as well as allowing for the simultaneous tool change.
It will be about two months before I will put power to this machine. Thank you to any and all who have comments on this matter. It is much appreciated.
Rob
'ToolChange Macro For Bed type tool changer 11/05 Brian (Butchered by novice)
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
NewTool = GetSelectedTool()
'Tool Changer Macro (Bed Type)
MaxToolNum = 17 'Max number off tools for the changer
ToolDown = 0 'Z Pos to Get or drop a tool
ToolUp = 11.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
ActivateSignal(Output3) 'Dust boot up
Code "G00 G53 Z" & ToolUp
While IsMoving()
Sleep 100
Wend
Call MovePos(OldTool) 'Move to toolchanger rack, offset from clip point
While IsMoving()
Sleep 100
Wend
Code "G53 Z" & ToolDown
While IsMoving()
Sleep 100
Wend
Call ClipMove(OldTool) 'Old tool, clipping into the tool fork
While IsMoving()
Sleep 100
Wend
ActivateSignal(Output2) 'Spindle tool grip release
Code "G4 P1" 'Wait for the tool to release
Code "G00 G53 Z" & ToolUp
While IsMoving
Wend'insert SystemWaitFor (4) 'Wait for the spindle tool sensor 1 SystemWaitFor (5) 'Wait for the spindle tool sensor 2
Call MovePosAct1(NewTool)
While IsMoving()
Wend
Code "G53 Z" & ToolDown 'We are on new tool now
While IsMoving()
Wend
DeActivateSignal(Output2) 'Spindle grips tool
Code "G4 P1.0" 'Wait for the tool to Clamp
Call UnClipMove(NewTool)
While IsMoving
Wend
Code "G53 Z" & ToolUp
Call SetUserDRO (1200,NewTool)
SetCurrentTool( NewTool )
DeactivateSignal(Output3) ' dust boot down
Code "G00 X" & x & " Y" & y 'Move back to where the tool change was prompted
End Sub
Sub MovePos(ByVal OldTool As Integer)
Select Case OldTool
Case Is = 1
Xpos = -15.5
YPos = 16
Case Is = 3
Xpos = -12.375
YPos = 16
Case Is = 8
Xpos = -9.250
YPos = 16
Case Is = 9
Xpos = -6.125
YPos = 16
Case Is = 10
Xpos = -15.5
YPos = 4
Case Is = 11
Xpos = -12.375
YPos = 4
Case Is = 12
Xpos = -9.25
YPos = 4.00
Case Is = 17
Xpos = -6.125
YPos = 4.00
End Select
Code "G53 X" & XPos & "Y" & YPos
End Sub
Main
Sub MovePosAct(ByVal OldTool As Integer)
Select Case OldTool
Case Is = 1
Xpos = -15.5
YPos = 13
Case Is = 3
Xpos = -12.375
YPos = 13
Case Is = 8
Xpos = -9.250
YPos = 13
Case Is = 9
Xpos = -6.125
YPos = 13
Case Is = 10
Xpos = -15.5
YPos = 7
Case Is = 11
Xpos = -12.375
YPos = 7
Case Is = 12
Xpos = -9.25
YPos = 7
Case Is = 17
Xpos = -6.125
YPos = 7
End Select
Code "G53 X" & XPos & "Y" & YPos
End Sub
Main
Sub MovePosAct1(ByVal NewTool As Integer)
Select Case NewTool
Case Is = 1
Xpos = -15.5
YPos = 13
Case Is = 3
Xpos = -12.375
YPos = 13
Case Is = 8
Xpos = -9.250
YPos = 13
Case Is = 9
Xpos = -6.125
YPos = 13
Case Is = 10
Xpos = -15.5
YPos = 7
Case Is = 11
Xpos = -12.375
YPos = 7
Case Is = 12
Xpos = -9.25
YPos = 7
Case Is = 17
Xpos = -6.125
YPos = 7
End Select
Code "G53 X" & XPos & "Y" & YPos
End Sub
Main
Sub ClipMove(ByVal OldTool As Integer)
Select Case OldTool
Case Is = 1
YPos = 13
Case Is = 3
YPos = 13
Case Is = 8
YPos = 13
Case Is = 9
YPos = 13
Case Is = 10
YPos = 7
Case Is = 11
YPos = 7
Case Is = 12
YPos = 7
Case Is = 17
YPos = 7
End Select
Code "G53 Y" & YPos
End Sub
Main
Sub UnClipMove(ByVal NewTool As Integer)
Select Case NewTool
Case Is = 1
YPos = 16
Case Is = 3
YPos = 16
Case Is = 8
YPos = 16
Case Is = 9
YPos = 16
Case Is = 10
YPos = 4
Case Is = 11
YPos = 4
Case Is = 12
YPos = 4
Case Is = 17
YPos = 4
End Select
Code "G53 Y" & YPos
End Sub
Main