I haven’t messed with it in years, but you could try something like
https://www.scorchworks.com/Gcoderipper/gcoderipper.html#documentation
bCNC can also probe a surface and modify your Z movement.
2 Likes