--Take a poke at this and see if it works for your
--machine state, for probing. I don't have a working probe,
--I am unable to test it. as an alternative, you could "NOT" the
--Run and Feedhold enums.
function test()
local inst = 0; local state = 0; local rc = 0;
--***** Mach4 Enum machine states *****
local states = {["0"] = "MC_STATE_IDLE", --nothing going on, ok to probe
["102"] = "MC_STATE_FRUN_PROBE", --unknown if this is applicable
["103"] = "MC_STATE_FRUN_PROBE_FH", --unknown if this is applicable
["202"] = "MC_STATE_MRUN_PROBE", --unknown if this is applicable
["203"] = "MC_STATE_MRUN_PROBE_FH" }--unknown if this is applicable
state, rc = mc.mcCntlGetState(inst);
if state == 0 or state == 102 or state == 103 or state == 202 or state == 203 then
state, rc = mc.mcCntlGetState(inst);
if state == 0 then
--states of instance that is running, i.e. RUN, STOP etc.
wx.wxMessageBox("Number State = " .. tostring(state),
"String State " .. states[tostring(state)],
wx.wxOK);
--If you got here, then it is OK to do probing, your code here......
end
end
end
if (mc.mcInEditor() == 1) then
test();
end