Hello Guest it is November 15, 2019, 04:12:42 PM

Author Topic: Creating an M6 Toolchange in Mach4 (Part 1)  (Read 2544 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Creating an M6 Toolchange in Mach4 (Part 1)
« on: October 06, 2015, 06:09:49 PM »
This is part 1 of creating my own M6 Toolchange in mach4

https://youtu.be/m1eMEec0N-E

The Code so far in this part

Code: [Select]
function M6()
    local inst = mc.mcGetInstance();
    local selectedtool = mc.mcToolGetSelected(inst)
    local currenttool = mc.mcToolGetCurrent(inst)

    if selectedtool == currenttool then
    return
    mc.mcCntlSetLastError(inst, "ToolChange Activated but Not Required")
    else
    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0")
    mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 X260 Y50")
    local changetoo = mc.mcToolGetDesc(inst,selectedtool)
    wx.wxMessageBox("Please change to tool number "..selectedtool.." "..changetoo.." and press ok to continue")

    wx.wxMessageBox('Toolchange finished')
    end

end

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


DazTheGas
Theres always time for a choccy biccy

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Creating an M6 Toolchange in Mach4 (Part 1)
« Reply #1 on: October 07, 2015, 03:24:49 AM »
 mc.mcCntlGcodeExecuteWait(inst,"G90 G53 G0 Z0.0 \n X260 \n Y50 ") can work the same as both Gcode lines, \n = wait to finished probably know that already

Offline DazTheGas

*
  •  750 750
  • DazTheGas
    • View Profile
Re: Creating an M6 Toolchange in Mach4 (Part 1)
« Reply #2 on: October 07, 2015, 03:37:37 AM »
Yes that is correct and such lines can be joined after function is finished, but during a tutorial it makes sense to show in separate steps so others can follow easier what the function is doing.

BTW \n = newline

DazTheGas
« Last Edit: October 07, 2015, 03:42:25 AM by DazTheGas »
Theres always time for a choccy biccy

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Creating an M6 Toolchange in Mach4 (Part 1)
« Reply #3 on: October 07, 2015, 03:42:29 AM »
cool more info on \n for other`s
http://www.lua.org/pil/2.4.html
« Last Edit: October 07, 2015, 03:49:11 AM by blockhead »