I've got this code working from within a button at the moment.
If i click the button the state of the toggle is set propperly.
Now i want tho run it inside a macro so i can use it inside my M6 when i do a toolchange.
But then the code refuses to work. Nothing happens.
I thinks it's because this is a gui related code and the screen does not refresh when running a macro (or gcode file).
Is there a way i can refresh the screen to set this button when running a macro or gcode?
I tought of putting some script in the plc script, but because of the loop sequence, the button "flickers" when i trie to do that.
Keep Safe,
Adam
function zControl.ButtonState()
local axisID, mc.mcMotorGetAxis(inst,Spindle)
local h_OUTPUT4 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT4)
local state = mc.mcSignalGetState(h_OUTPUT4)
if ((axisID == mc.Z_AXIS) and (state == 1) then
scr.SetProperty('togRouterSpindle', 'Button State', (0))
else
scr.SetProperty('togRouterSpindle', 'Button State', (1)
end
end