Here is some test VB I did a while ago to go shortest route on a 6 position turret, it should give you some idea of how it could be done.
OldTool = GetCurrentTool()
NewTool = GetSelectedTool()Mod 6
If NewTool = 0 Then
NewTool = 6
End If
If NewTool > OldTool Then
ToolCount = NewTool - OldTool
If ToolCount < 4 Then
TurretDir = 1
Else
TurretDir = 2
End If
End If
If OldTool > NewTool Then
ToolCount = OldTool - NewTool
If ToolCount < 4 Then
TurretDir = 2
Else
TurretDir = 1
End If
End If
If TurretDir = 1 Then
MsgBox"Turret is Clockwise"
Else
If TurretDir = 2 Then
MsgBox"Turret is AntiClockwise"
End If
End If
SetCurrentTool(NewTool)
The last part just pops up a message as I was only using it to test, in that part you would have to do whatever was required to start the turret moving to the tool required.
If you had a stepper or servo set as an axis thenMach could handle the shortest route internally, so all depends on how you proceed.
Hood