Ok so i had mistaken how G92 works and have now removed all G92. The only problem i have now is that tool offset is accounted for but applied after toolchange.
So i do a Z probe move, probe triggers and i save the position. (local ZBefore = mc.mcAxisGetPos(inst, 2)
I go to manual toolchange position and put up a dialog to change tool.
After pressing ok the machine returns to probe location and does another probe move. When the probe triggers i set the axis position to the saved value. (mc.mcAxisSetPos(inst, 2, ZBefore) )
Now i get my problem: When my program now continiues after running the script my position is offset Per the tool table resulting in my job continues "selected tools offset" higher than it started...
What is the best way to correct this?
Can i just add the offset before setting the axis position like:
mc.mcAxisSetPos(inst, 2, ZBefore + mc.mcToolGetData(finst, mc.MTOOL_MILL_HEIGHT, mc.mcToolGetSelected(inst)) )
??