Hello Guest it is May 10, 2021, 10:04:51 PM

Author Topic: M6 macro in 4.2.0-3233  (Read 1023 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 »

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))
        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))

if (mc.mcInEditor == 1) then

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
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.