I take it you are trying to replicate the ABS encoders found on moderm machine tools on a MACH3 budget ??

Install encoders route them to Mach3 DROs,

Calibrate the encoder to machine travel

When you Refhome the machine to Machine 0,0 then zero the encoder DROs as well.

IF you munch the machine and want to get back to zero do a compare of where you are to the Encoder DROs then calculate how far to move to get back to encoder 0,0 then move and setmachine Zero to 0,0.

THat is the simple version,

Home switches would be simpler(;-)

Personelly I would study and practice more with Gcode and the CNC so you did NOT munch the machine as often.

(;-) TP