'ToolChange Macro For CNC RouterSub Main()Dim Xpos As DoubleDim Ypos As DoubleOldTool = GetOEMDRO (824) 'Tool In spindle DRO 1200 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 (Router Type)MaxToolNum = 8      'Max number off tools for the changerToolDown   = -8.1452 'Z Pos to Get or drop a toolToolUp     = -4.50   'Z Hieght to Rapid from tool to toolPullout    = -3.0    'The amount the it will move to slide the tool inSafeUp     = -1.50   'Z Hieght to Rapid to and from tool rackXpos	   =0.0Ypos       =0.0If NewTool = OldTool Then 	Exit SubEnd IfWhile NewTool > MaxToolNum	NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)WendActivateSignal(Output3) 'hood upCode "G4 P1.0"    'Wait for the hood to riseCode "G00 G53 Z" & SafeUpWhile IsMoving()	Sleep(10)Wend'******************** Move to the Load Position *****************************Call MovePos(OldTool,Xpos,Ypos)'This will update the X and Y to the right position for the toolchangeCode ("G53 Y75.0000")Code ("G53 X" & Xpos & " Y" & Ypos + Pullout) ''Move to where we can load the toolWhile IsMoving()	Sleep(10)WendCode "G53 Z" & ToolDownCode ("G53 G01 X" & Xpos & " Y" & Ypos & "F50.") 'Push it in Code "G4 P.75"While IsMoving()	Sleep(10)WendActivateSignal(Output2) 'Turn On Draw bar to release the toolCode "G4 P1.0"    'Wait for the tool to release'SystemWaitFor (7) 'Wait for the tool Release Limit switchCode "G00 G53 Z" & ToolUp'************** Get new tool position ***********************************Call MovePos(NewTool,Xpos,Ypos)'Get the position for the New tool.. Code ("G53 X" & Xpos & " Y" & Ypos)While IsMoving()	Sleep(10)WendCode "G53 G01 Z" & ToolDownCode "G4 P.75"While IsMoving()	Sleep(10)WendDeActivateSignal(Output2) 'Turn Off Draw bar to Clamp the toolCode "G4 P1.0"    'Wait for the tool to ClampWhile IsMoving()	Sleep(10)WendCode ("G53 X" & Xpos & " Y" & Ypos + Pullout)'Pull outCode "G0 G53 Z" & SafeUpCode "G0 G53 Y102"While IsMoving()	Sleep(10)WendCall SetUserDRO (1200,NewTool)SetCurrentTool( NewTool )DeActivateSignal(Output3) 'lower hoodCode "G4 P1.0"    'Wait for the hood downEnd SubSub MovePos(ByVal ToolNumber As Integer, ByRef Xpos As Double, ByRef Ypos As Double)Select Case ToolNumber       Case Is = 1 'Set the position for each tool here...          Xpos = 7.1842         YPos = 114.1661       Case Is = 2         Xpos = 11.9921         YPos = 114.1901       Case Is = 3         Xpos = 16.9125         YPos = 114.1901       Case Is = 4         Xpos = 21.5038         YPos = 114.1901       Case Is = 5         Xpos = 28.6204         YPos = 114.1701       Case Is = 6         Xpos = 33.3317         YPos = 114.2050       Case Is = 7         Xpos = 38.0004         YPos = 114.2491       Case Is = 8         Xpos = 42.9373         YPos = 114.2491End SelectEnd SubMain                           