Hi,
this is the action script for the Set Tool Button on the Offsets page:
--Set Tool button
local inst = mc.mcGetInstance()
local GageBlock = scr.GetProperty("droGageBlockT", "Value")
local CurTool = mc.mcToolGetCurrent(inst) --Current Tool Num
local OffsetState = mc.mcCntlGetPoundVar(inst, 4008) --Current Height Offset State
mc.mcCntlGcodeExecuteWait(inst, "G49")
GageBlock = tonumber(GageBlock)
local ZPos = mc.mcAxisGetPos(inst, mc.Z_AXIS)
local OffsetVal = ZPos - GageBlock
mc.mcToolSetData(inst, mc.MTOOL_MILL_HEIGHT, CurTool, OffsetVal)
mc.mcCntlSetLastError(inst, string.format("Tool %.0f Height Offset Set: %.4f", CurTool, OffsetVal))
if (OffsetState ~= 49) then
mc.mcCntlMdiExecute(inst, string.format("G%.1f", OffsetState))
end
Craig