Sub Main()OldTool = GetOEMDRO (824) 'Tool In spindle DRO You must add this to your settings screenx = GetToolChangeStart( 0 )y = GetToolChangeStart( 1 ) z = GetToolChangeStart( 2 ) a = GetToolChangeStart( 3 ) tool = GetSelectedTool()NewTool = toolMaxToolNum = 6      'Max number off tools for the changerWhile NewTool > MaxToolNumNewTool = Question ("Enter New Tool Number - 1 to 6")WendBreakTool = 99If IsActive (input2) ThenBreakTool = 0End IfWhile BreakTool = OldToolOldTool = Question("Enter Number Of Tool In Spindle - 1 to 6")Wend ToolNumber = OldToolSelect Case ToolNumber  Case Is = 0  Tooldown = 0  Case Is = 1  Tooldown = -3.425  Case Is = 2  Tooldown = -3.500  Case Is = 3  Tooldown = -3.625  Case Is = 4  Tooldown = -3.425  Case Is = 5  Tooldown = -3.500  Case Is = 6  Tooldown = -3.573End SelectToolUp     = 0.0    'Z Hieght to Rapid from tool to toolIf NewTool = OldTool Then 	Exit SubEnd IfCode "G00 G53 Z" & ToolUpWhile IsMoving()WendToolnumber = OldToolSelect Case ToolNumber        Case Is = 0         YPos = y        Case Is = 1         YPos = 14.594        Case Is = 2         YPos = 9.669        Case Is = 3         YPos = 4.676        Case Is = 4         YPos = 14.594        Case Is = 5         YPos = 9.669        Case Is = 6         YPos = 4.676End SelectCode "G53 Y" & YPosWhile IsMoving()WendCode "G53 Z" & ToolDownWhile IsMoving()WendSelect Case ToolNumberCase Is = 1 ActivateSignal (Output12) Sleep 2000 ActivateSignal (Output16) Sleep 1500 code "G53 Z" & Toolup While IsMoving() Wend DeActivateSignal (Output12) ActivateSignal (Output13) DeActivateSignal (Output16)Sleep 2000 DeActivateSignal (Output13) Case Is = 2 ActivateSignal (Output12) Sleep 2000 ActivateSignal (Output16) Sleep 1500 code "G53 Z" & Toolup While IsMoving() Wend DeActivateSignal (Output12) ActivateSignal (Output13) DeActivateSignal (Output16) Sleep 2000 DeActivateSignal (Output13) Case Is = 3 ActivateSignal (Output12) Sleep 2000 ActivateSignal (Output16) Sleep 1500 code "G53 Z" & Toolup While IsMoving() Wend DeActivateSignal (Output12) ActivateSignal (Output13) DeActivateSignal (Output16) Sleep 2000 DeActivateSignal (Output13) Case Is = 4 ActivateSignal (Output14) Sleep 2000 ActivateSignal (Output16) Sleep 1500 code "G53 Z" & Toolup While IsMoving() Wend DeActivateSignal (Output14) ActivateSignal (Output15) DeActivateSignal (Output16) Sleep 2000 DeActivateSignal (Output15) Case Is = 5ActivateSignal (Output14) Sleep 2000 ActivateSignal (Output16) Sleep 1500 code "G53 Z" & Toolup While IsMoving() Wend DeActivateSignal (Output14) ActivateSignal (Output15) DeActivateSignal (Output16) Sleep 2000 DeActivateSignal (Output15) Case Is = 6 ActivateSignal (Output14) Sleep 2000 ActivateSignal (Output16) Sleep 1500 code "G53 Z" & Toolup While IsMoving() Wend DeActivateSignal (Output14) ActivateSignal (Output15) DeActivateSignal (Output16) Sleep 2000 DeActivateSignal (Output15) End SelectToolNumber = NewToolSelect Case ToolNumber        Case Is = 1         YPos = 14.594        Case Is = 2         YPos = 9.669        Case Is = 3         YPos = 4.676        Case Is = 4         YPos = 14.594        Case Is = 5         YPos = 9.669        Case Is = 6         YPos = 4.676End SelectCode "G53 Y" & YPosWhile IsMoving()WendSelect Case ToolNumber  Case Is = 1  Tooldown = -3.425  Case Is = 2  Tooldown = -3.500  Case Is = 3  Tooldown = -3.625  Case Is = 4  Tooldown = -3.425  Case Is = 5  Tooldown = -3.500  Case Is = 6  Tooldown = -3.573End SelectSelect Case ToolNumberCase Is = 1 ActivateSignal(Output12) ActivateSignal(Output16) Sleep 2000 Code "g53 z" & ToolDown While IsMoving() Wend DeActivateSignal(Output16) Sleep 2000 DeActivateSignal(Output12) ActivateSignal(Output13) Sleep 2000 DeActivateSignal(Output13)  Case Is = 2 ActivateSignal(Output12) ActivateSignal(Output16) Sleep 2000 Code "g53 z" & ToolDown While IsMoving() Wend DeActivateSignal(Output16) Sleep 2000 DeActivateSignal(Output12) ActivateSignal(Output13) Sleep 2000 DeActivateSignal(Output13) Case Is = 3 ActivateSignal(Output12) ActivateSignal(Output16) Sleep 2000 Code "g53 z" & ToolDown While IsMoving() Wend DeActivateSignal(Output16) Sleep 2000 DeActivateSignal(Output12) ActivateSignal(Output13) Sleep 2000 DeActivateSignal(Output13) Case Is = 4 ActivateSignal(Output14) ActivateSignal(Output16) Sleep 2000 Code "g53 z" & ToolDown While IsMoving() Wend DeActivateSignal(Output16) Sleep 2000 DeActivateSignal(Output14) ActivateSignal(Output15) Sleep 2000 DeActivateSignal(Output15) Case Is = 5 ActivateSignal(Output14) ActivateSignal(Output16) Sleep 2000 Code "g53 z" & ToolDown While IsMoving() Wend DeActivateSignal(Output16) Sleep 2000 DeActivateSignal(Output14) ActivateSignal(Output15) Sleep 2000 DeActivateSignal(Output15) Case Is = 6 ActivateSignal(Output14) ActivateSignal(Output16) Sleep 2000 Code "g53 z" & ToolDown While IsMoving() Wend DeActivateSignal(Output16) Sleep 2000 DeActivateSignal(Output14) ActivateSignal(Output15) Sleep 2000 DeActivateSignal(Output15) End SelectCall SetUserDRO (824,NewTool)SetCurrentTool( NewTool )Code "G00 Y" & y 'Move back to where the tool change was promptedCode "G00 Z" & ZWhile IsMoving() WendEnd SubMain         