The problem here is that the axis will always move a little just after the probe trippes, it can't stop immediately and the distance directly linked to the feed rate used for probing. The location where the axis stops is not the same location where the probe tripped so you will have to take that difference into account either by moving back to the probed location or calculate the delta before setting the DRO.
This is true but I'm not sure it is a factor in this case.
First, the feed rate during the probe sequence is just 2 IPM. Once the touch point is reached, the mill should stop within a few thousandths.
Also, the 2 touch points (
YPos1 and
YPos2) are noted and the average (center) between the two points is assigned to a new variable,
YCenter. The same is true with the X axis (
XPos1,
XPos2, and
XCenter). Once the X and Y center points are both determined, the mill returns to this position and lowers the Z axis to the recorded touch point at the top of the part. It is this point that I'd like the DROs to be reset to X=0, Y=0, Z=0. Given that the touch points are recorded during the touch probe routine and then the mill later returns to this point, there should be no overtravel of the mill, at least I think there wouldn't be. I'm still very green at this stuff.
I have a semi-working solution but it is the principle of the problem that will keep me searching for a solution.