Hi Faby,
Code "G31 Z-230 F600"
While IsMoving()
Wend
Code "G91 G00 Z2"
Code "G31 Z-10 F60"
While IsMoving()
Wend
HitOld = GetVar(2002)
It works fine, but only when I run step by step...
Ok, I think you must wait after movement G91 G00 Z2:
Code " G91 G00 Z2"
While IsMoving()
Wend
Code " G31 Z-10 F60"
While IsMoving()
Wend.
Thats the reason because it does work step by step.
But be careful!!
Th G91 command sets the mode to G91 ... (really logic,

)
If your mode at the beginning of your measure macro was G90,
your macro returns with G91! Your crash will be shure..
So read the G9x-Status (from LED) first in your macro and restore it
after measurement...
@ REM300WM:
You cannot connect a macro with DROs only with buttons.
So you must place a button with VB-Script function on your screen and
have to place your code there...
Greetings from Germany,
Wolfram