Hi,
theres some confusion happening here.
The first two lines are:
local inst = mc.mcGetInstance()
local ToolDrumAtSpindle = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT9)
and the fourth line is:
if mc.mcSignalGetState(ToolDrumAtSpindle ==1 ) then
As you have written it 'TooDrumAtSpindle' is a HANDLE.....not a variable. Whereas in the fourth line you are treating in confused fashion,
for example you have written ToolDrumAtSpindle==1......what does that mean?. I can see what you are trying to do but you are confusing
a HANDLE and a VARIABLE.
Try this:
local inst=mc.mcGet Instance()
local ToolDrumAtSpindleHANDLE=mc.mcSignalGetHandle(inst, mc.ISIG_INPUT9)
local ToolDrumToSpindleHANDLE = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT8)
local ToolDrumAtSpindle=mc.mcSignalGetState(ToolDrumAtSpindleHANDLE)
if (ToolDrumAtSpindle ==1 ) then
mc.mcSignalSetState(ToolDrumToSpindleHANDLE,0)
else
mc.mcSignalSetState(ToolDrumToSpindleHANDLE,1)
end
So to correctly populate a variable requires a two step process, first you get the HANDLE, that is equivalent to the memory
address of the signal, then you use the mcSignalGetState(handle) to read the contents of that memory location.
To set an output you use the output signals HANDLE and the data or state which you wish to apply.
Craig