function m60() inst = mc.mcGetInstance() -- Get the current instance --check for manual cut and wait if manual cut on local hregC = mc.mcRegGetHandle(inst, 'iRegs0/ManCut') local ManualCut = mc.mcRegGetValue(hregC) if (ManualCut == 1) then wx.wxMessageBox("Press Manual Cut Button") end while (ManualCut == 1) do wx.wxMilliSleep(100) ManualCut = mc.mcRegGetValue(hregC) ManCutWasOn = 1 end if (ManCutWasOn == 1) then mc.mcRegSetValue(hregC, 1) else mc.mcRegSetValue(hregC, 0) end --close feed clamps if open local hsig = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1) local FeedClampClosed = mc.mcSignalGetState(hsig) if (FeedClampClosed == 0) then mc.mcSignalSetState(hsig, 1); --sets OUTPUT_1 to True local time1 = 200 wx.wxMilliSleep(time1) end --fire cut with timer local cut1 = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT7) mc.mcSignalSetState(cut1, 1); --sets OUTPUT_7 to True local time2 = 2300 wx.wxMilliSleep(time2) --retract cut with timer local cut1b = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT7) mc.mcSignalSetState(cut1b, 0); --sets OUTPUT_7 to False local time3 = 500 wx.wxMilliSleep(time3) --retract material to start position mc.mcCntlGcodeExecute(inst, "G91 G0 X-35.5") mc.mcCntlGcodeExecute(inst, "G90") end if (mc.mcInEditor() == 1) then m60() end