thanx Dan!
...here's the hot key package I got so far. still working on that auto tool sequence tho.
--josh
--Probe input.
sigLib[mc.ISIG_INPUT0] = function (state)
local inst = mc.mcGetInstance ()
if state == 1 then
mc.mcCntlCycleStop(inst)
for i=1, myAxes do mc.mcMotorIsStill (inst, i)end
end
end
--Tool setter input
sigLib[mc.ISIG_INPUT1] = function (state)
local inst = mc.mcGetInstance ()
if state == 1 then
for i=0, myAxes do mc.mcJogVelocityStop (inst,i) end
end
end
--Keyboard Sim '2' w/Caps Lock on for auto tool zero sequence
sigLib[mc.ISIG_INPUT58] = function (state)
local inst = mc.mcGetInstance ()
local hSig = mc.mcSignalGetHandle (inst, mc.OSIG_TOOL_CHANGE)
local sigState = mc.mcSignalGetState (hSig)
if state == 1 then
if sigState == 0 then
mc.mcSignalSetState (hSig, 1)
flag[1] = 1
elseif sigState == 1 then
mc.mcSignalSetState (hSig, 0)
flag[1] = 0
end
end
end
--Keyboard Sim '1' w/Caps Lock on for start tool setter calibration.
sigLib[mc.ISIG_INPUT59] = function (state)
local inst = mc.mcGetInstance ()
local hSig = mc.mcSignalGetHandle (inst, mc.OSIG_OUTPUT30)
local sigState = mc.mcSignalGetState (hSig)
if state == 1 then
if sigState == 0 then
mc.mcSignalSetState (hSig, 1)
flag[1] = 1
elseif sigState == 1 then
mc.mcSignalSetState (hSig, 0)
flag[1] = 0
end
end
end
--Keyboard Sim 'F1' w/Caps Lock on to enable Mach 4.
sigLib[mc.ISIG_INPUT60] = function (state)
local inst = mc.mcGetInstance ()
if state == 1 then
mc.mcCntlEnable (inst, 1)
end
end
--Keyboard Sim 'C' w/Caps Lock on to center table.
sigLib[mc.ISIG_INPUT61] = function (state)
local inst = mc.mcGetInstance ()
local gCode = ""
if state == 1 then
gCode = "G00 G90 G53 Z0.0 \n"
gCode = gCode .."G53 X9.0 Y2.0 \n"
mc.mcCntlMdiExecute (inst, gCode)
end
end
--Keyboard Sim 'Esc' for Estop.
sigLib[mc.ISIG_INPUT62] = function (state)
local inst = mc.mcGetInstance ()
local rc = 0
if state == 1 then
mc.mcCntlEStop (inst, 1)
end
end
--Keyboard Sim 'H' w/Caps Lock on to home all axes.
sigLib[mc.ISIG_INPUT63] = function (state)
local inst = mc.mcGetInstance ()
if state == 1 then
mc.mcAxisHomeAll (inst)
end
end