Ok so after thinking about this for a while i decided to leave the original macros as they were because they work just fine, but to modify Gerrys M889 macro adding in a few extra variables and commands.
This was my rough working out:
ZORIGINAL= GETVAR(5223) 'GET CURRENT G54 Z VALUE
****'DO M889 PROBING ROUTINE****
ZCURRENT= GETVAR(5223) 'GET G54 Z VALUE AFTER SETTING NEW TOOL
ZDIFFERENCE= ZORIGINAL-ZCURRENT ' CALCULATE THE DIFFERENCE BETWEEN THE PREVIOUS AND CURRENT TOOL
OFFSET2= (GETVAR(5243)-ZDIFFERENCE)
SETVAR(5243,OFFSET2)
SLEEP(200)
OFFSET3= (GETVAR(5263) -ZDIFFERENCE)
SETVAR(5263,OFFSET3)
SLEEP(200)
OFFSET4= (GETVAR(5283) -ZDIFFERENCE)
SETVAR(5283,OFFSET4)
SLEEP(200)
OFFSET5= (GETVAR(5303) -ZDIFFERENCE)
SETVAR(5303,OFFSET5)
SLEEP(200)
OFFSET6= (GETVAR(5323) -ZDIFFERENCE)
SETVAR(5323,OFFSET6)
SLEEP(200)
OFFSET7= (GETVAR(5343) -ZDIFFERENCE)
SETVAR(5343,OFFSET7)
SLEEP(200)
OFFSET8= (GETVAR(5363) -ZDIFFERENCE)
SETVAR(5363,OFFSET8)
SLEEP(200)
OFFSET9= (GETVAR(5383) -ZDIFFERENCE)
SETVAR(5383,OFFSET9)
SLEEP(200)
OFFSET10= (GETVAR(5403) -ZDIFFERENCE)
SETVAR(5403,OFFSET10)
SLEEP(200)
OFFSET11= (GETVAR(5423) -ZDIFFERENCE)
SETVAR(5423,OFFSET11)
SLEEP(200)
OFFSET12= (GETVAR(5443) -ZDIFFERENCE)
SETVAR(5443,OFFSET12)
SLEEP(200)
OFFSET13= (GETVAR(5463) -ZDIFFERENCE)
SETVAR(5463,OFFSET13)
SLEEP(200)
OFFSET14= (GETVAR(5483) -ZDIFFERENCE)
SETVAR(5483,OFFSET14)
SLEEP(200)
OFFSET15= (GETVAR(5503) -ZDIFFERENCE)
SETVAR(5503,OFFSET15)
SLEEP(200)
OFFSET16= (GETVAR(5523) -ZDIFFERENCE)
SETVAR(5523,OFFSET16)
SLEEP(200)
OFFSET17= (GETVAR(5543) -ZDIFFERENCE)
SETVAR(5543,OFFSET17)
SLEEP(200)
OFFSET18= (GETVAR(5563) -ZDIFFERENCE)
SETVAR(5563,OFFSET18)
SLEEP(200)
I added the variables into the original M889 macro and placed the relevant lines where i thought they should be, and it seems to work well enough for my current needs...
I can probe all my offsets with my digitizing probe (using a Gcode program I wrote utilizing Gerrys original M899 code.), this initially populates the offset table for all my z positions with values relative to the probe length.
Then i can change the tool from my probe to my cutting tool and re-zero the G54 offset(using my modified Macro) with my movable touch plate.
As the macro is written i have to zero the tool or any subsequent tool in the G54 offset and then it adjusts the other offsets based on the difference found in G54 between the prior z offset and the newly set value.
I would love it if we could incorporate this functionality into the auto tool zero function but i think that is beyond my capabilities. To be honest I'm surprised i managed to get this to work.
I will attach the modified Macro which i have tested and appears to work on my Machine with the Chinese controller, however i offer it as for reference only and and you should check and test this out fully before implementing it for your purposes.
I renamed the modified macro to M950 so i can still utilize the original M889, and i just call it from the MDI screen when i need it.
Big thanks to Gerry for his continued support and help with the macros and his 2010 screen set.
Anyone who has any input on the macro is more than welcome to comment of contribute if they can.
(Gerry, If its not the done thing to post your macros on here, even if modified then please feel free to remove it or ask me to do so, if i can, and i apologize if this is the case) Sorry still new to the forum and the whole CNC thing to be honest.
Cheers
Olly