function m42() local inst = mc.mcGetInstance("Spindle range 2") local rc local currentRange currentRange, rc = mc.mcSpindleGetCurrentRange(inst) if (currentRange == 2) then return -- nothing to do! end -- Do the machine dependent range change control. -- -- End machine dependent range change control -- Next, tell Mach what rage we are now in IF the above is successful. mc.mcSpindleSetRage(inst, 2) end if (mc.mcInEditor() == 2) then m42() end