REM A.T.Z. 

If Not GetLed (7) Then ' è referenziato X
vxled = 1
End If

If Not GetLed (8) Then ' è referenziato Y
vyled = 1
End If

If Not GetLed (9) Then ' è referenziato Z
vzled = 1
End If

Tled = vxled + vyled + vzled

If Tled = 3 Then ' se non sono referenziati X, Y e Z esco

If IsSuchSignal (22) Then                  ' Il Probe è abilitato

DoSpinStop()                                     ' Fermo il Motore


Xpos = GetParam("XMachine")         ' Memorizzo XY in Assoluto
Ypos = GetParam("YMachine")
Zpos = GetParam("ZDRO")               ' Memorizzo Z in Relativo
Fcurr = GetParam("FeedRate")          ' Memorizzo FeedRate corrente

code "G53 G0 Z0"
code "G53 G0 X64.7 Y-19.95"                  ' Posizione inizio ricerca Assoluta Switch Zero XY 

While IsMoving()
Wend

code "G53 Z-1"

While IsMoving()
Wend


tmp = (GetParam("ZDRO")-200 )

code "G31 Z" & tmp & "F120"     ' Cerco Switch fino a -200
code "G4 P1" 

While IsMoving()
Wend
   
Call SetDRO( 2,GetUserDRO(2001))            

'SetParam("FeedRate",Fcurr) 
code "G0 G53 Z0"
While IsMoving()
Wend
MsgBox ("Utensile Azzerato Correttamente")
End If

Else
MsgBox ("Per poter cambiare l'utensile bisognava prima aver referenziato la macchina")
End If  
       
 

