Hello Guest it is April 28, 2024, 03:56:37 PM

Author Topic: Spindle and coolant stop on M01  (Read 651 times)

0 Members and 1 Guest are viewing this topic.

Re: Spindle and coolant stop on M01
« Reply #10 on: April 14, 2023, 10:33:16 AM »
Ok. I have it made. I’m just not at my desk at the moment.
Chad Byrd
Re: Spindle and coolant stop on M01
« Reply #11 on: April 14, 2023, 11:57:19 AM »
You will have to ensure that you turn your spindle and coolant back on after the M101 is called. 
But this should get you going.

function m101()
local inst = mc.mcGetInstance()
local m01 = mc.mcSignalGetHandle(inst, mc.OSIG_OPT_STOP)
local m01State = mc.mcSignalGetState(m01)
local CoolantOutput = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON)
if m01State == 1 then
    mc.mcSignalSetState(CoolantOutput, 0)
    mc.mcSpindleSetDirection(inst, 0);
    mc.mcCntlFeedHold(inst)
end--m101State
end

if (mc.mcInEditor() == 1) then
   m101()
end
Chad Byrd
Re: Spindle and coolant stop on M01
« Reply #12 on: April 16, 2023, 03:54:44 PM »
Chad, Thank you. That works exactly how I wanted. I use Easy Turn to generate my g-code. I wrote my own post processor and I have it generate a new spindle speed and start spindle for every operation, so inserting a m101 at the end of each tool operation works for me beautifully. Thanks again!