NumPositions=8 'This is where you set the number of tool positions that you have
tool = GetSelectedTool()
While Tool > NumPositions + 1
Tool = Question ("Invalid Tool Requested, New Tool Number?")
Wend
'Oldpos = GetDRO (3) *360/NumPositions
Oldpos = GetDRO (3)
If tool = 9 Then
Post = 1
Else
Post = tool
End If
NewPos = (Post-1)*360/Numpositions
b= (Post-1)*360/Numpositions
MoveDis = NewPos - OldPos
If Abs(MoveDis) >180 Then
If MoveDis < 0 Then
MoveDis = 360 + MoveDis
Else
MoveDis = MoveDis - 360
End If
End If
Code "M10"
Code "G4 P0.5"
Code "G00 G53 Z0"
Code "G00 G91 A" & MoveDis
Code "G90"
While IsMoving ()
Wend
Code "M11"
'Call SetDRO(3 , NewPos )
SetCurrentTool( tool )