Hello Guest it is December 10, 2019, 03:34:51 AM

Author Topic: M6 macro in 4.2.0-3233  (Read 842 times)

0 Members and 1 Guest are viewing this topic.

M6 macro in 4.2.0-3233
« on: March 03, 2017, 03:32:18 PM »
Hi

I recently updated from Mach4 4.2.0-2914 to 4.2.0-3233 and discovered that my manual tool change macro does no longer work.

The macro looks like this:

function m6()
    local inst = mc.mcGetInstance()
    local selectedTool = mc.mcToolGetSelected(inst)
    local selectedToolDescription = string.format("%d: %s", selectedTool, mc.mcToolGetDesc(inst, selectedTool))
    local currentTool = mc.mcToolGetCurrent(inst)
    local currentToolDescription = string.format("%d: %s", currentTool, mc.mcToolGetDesc(inst, currentTool))
    if selectedTool == currentTool then
        mc.mcCntlSetLastError(inst, string.format("Current tool \"%s\" is selected tool, no change required", currentToolDescription))
    else
        mc.mcCntlSetLastError(inst, string.format("Please insert tool \"%s\" and hit cycle start", selectedToolDescription))
        mc.mcCntlToolChangeManual(inst, true)
        mc.mcToolSetCurrent(inst, selectedTool)
        mc.mcCntlGcodeExecuteWait(inst, string.format("G43 H%d", selectedTool))
    end
end

if (mc.mcInEditor == 1) then
    m6()
end

In Mach4 3233 this macro does no longer work. Symptoms are that the on the first tool change after program start always the selected tool is the current tool. On subsequent tool changes I always need to issue the tool chance to have to right tool set.

Does anybody has an idea what might be the problem?

Thanks in advance
Mark
Re: M6 macro in 4.2.0-3233
« Reply #1 on: March 03, 2017, 04:04:41 PM »
I think found the problem.
I use to change the tool manually by putting "T12M6" as a single line in MDI.
After changing the "Tool Change Type" to "T on M6 line is tool to use" every works as expected.