Ok have a little play with something like this
in the events tab for the enable button delete the Down Action and place this in the Down Script
local inst = mc.mcGetInstance()
function CheckHomeState()
local en_axis = 0
repeat
local Is_Enabled = mc.mcAxisIsEnabled(inst, en_axis)
if Is_Enabled == 1 then
local is_Homed = mc.mcAxisIsHomed(inst, en_axis)
if is_Homed ~= 1 then
HomeDialog()
return
end
end
en_axis = en_axis + 1
until( en_axis == 6 )
mc.mcCntlEnable(inst, 1)
end
function HomeDialog()
local h_dialog = wx.wxMessageDialog(wx.NULL,"Clicking Ok will Home all Axis, Cancel will abort", "Warning Machine Not Homed",wx.wxOK + wx.wxCANCEL)
local test = h_dialog:ShowModal()
if test == wx.wxID_OK then
mc.mcCntlEnable(inst, 1)
wait = coroutine.create (RefAllHome)
else
scr.SetProperty('tbutton2','Button State','Up')
return
end
end
CheckHomeState()
Seems to work ok on my machine :-)
DazTheGas