If I recall correctly any offset the thc applies while the torch is cutting is removed when the torch is turned off
and the z axis is commanded to move up. So when the torch is first turned off and some height correction had been applied to Z during the cut the Z position will be off by that correction. It will not be corrected until the Z axis moves a sufficient amount up to remove it.
Couple things to try...
Increase the raise height of Z after the cut to allow more movement to remove the offset.
Code:
M5 (Torch Off)
<---- error happens at this moment
G0 Z30.000 <--- as result real position of cutter is either too high or too low
If your machine has more Z travel
Code:
M5 (Torch Off)
<---- error happens at this moment
G0 Z60.000 <--- Or whatever is safe for your machine and conditions
If the raise height cannot be increased perhaps add an extra movement to take up the correction.
Code:
M5 (Torch Off)
<---- error happens at this moment
G0 Z30.000 <--- as result real position of cutter is either too high or too low
G0 Z20.000
G0 Z30.000
The slats on my machine are a bit far apart and when working on light metal which might be warped I find it might be better to be able to probe below Z0.
In my case I prefer to make these moves at a slower rate so I use G1 instead of G0.
Rick G