'ToolChange Macro for Turret type tool changer – 8 tools 04/10/24 Sub Main()OldTool = GetOEMDRO (1200) 'Tool In spindle DRO You must add this to your settings screen before starttool = GetSelectedTool()NewTool = tool'Tool Changer Macro (Turret Type)MaxToolNum = 8      'Max number off tools for the changerIf NewTool = OldTool Then Exit Sub			'no tool change neededEnd IfWhile NewTool > MaxToolNum Or Newtool < 1NewTool = Question ("Enter New Tool Number up to " & MaxToolNum)Wendx = GetToolChangeStart( 0 )	'save last programmed xz = GetToolChangeStart( 2 ) 	'save last programmed zCode "G53 x10 z-10"	Call MovePos(NewTool)While IsMoving()Wend Code "G00 X" & x & " Z" & z While IsMoving()WendCall SetUserDRO (1200,NewTool)	'Updates DRO and settingsSetCurrentTool( NewTool )End SubSub MovePos(ByVal ToolNumber As Integer)Select Case ToolNumber       Case Is = 1         Apos = 3		'Assumes A-axis for turret position before lock         Alock = -350		'This is locked position       Case Is = 2         Apos = 48         Alock = -38       Case Is = 3         Apos = 93         Alock = -85       Case Is = 4         Apos = 138         Alock = -129       Case Is = 5         Apos = 183         Alock = -175       Case Is = 6         Apos = 228         Alock = -219       Case Is = 7         Apos = 273         Alock = -264                                                                                                                                     Case Is = 8         Apos = 318         Alock = -309              End SelectCode "G00 A" & Apos				Code "G04 P1"			'Could be shorter pause or none?Code "G00 A" & Alock	Code "G04 P1"			'Could be shorter pause or none?While IsMoving()WendSetOemDRO(803,Apos-3) 'This bit is added to set DRO to position wantedSleep 1000	'Wait for 1 second End SubMain                                              