1
Mach4 Toolbox / Table Vacuum Lua Script
« on: November 26, 2023, 08:41:21 PM »
Hello All,
Here is a copy of my script to vacuum my mill top. My table is x=110 and y=63 inches. You will need to adjust the X and Y numbers for you mill size.
Here is a copy of my script to vacuum my mill top. My table is x=110 and y=63 inches. You will need to adjust the X and Y numbers for you mill size.
Code: [Select]
-- ======================================
-- | Vacuum the table surface
-- | By Jim Anderson
-- | July 10 2016
-- | ---------------------------------------------
-- | This program will vacuum the top of the table
-- |
-- ==========================================
-- -------------------------------------------------
function GCodeExecute(GCodeString)
local inst = mc.mcGetInstance()
local rc = mc.mcCntlGcodeExecuteWait(inst, GCodeString)
if rc ~= mc.MERROR_NOERROR then
return "GCode failed", false
end -- if end
end -- function end
-- -------------------------------------------------
function TableVac()
local inst = mc.mcGetInstance()
mc.mcCntlSetLastError(inst, "Starting Table Vacuum") -- Log Message
local MyChoice1 = wx.wxMessageBox("Did you remove the tool from the spindle?\nClick OK to continue", "Are You Sure?", 16)
if (MyChoice1 == 16) then -- 16 is a cancel
return -- exit out
elseif (MyChoice1 == 4) then
local MyChoice2 = wx.wxMessageBox("Did you zero Z for the Brush?\nClick OK to continue", "Are You Sure?", 16)
if (MyChoice2 == 16) then -- 16 is a cancel
return -- exit out
elseif (MyChoice2 == 4) then
GCodeExecute("M08") -- Dust Collector On
GCodeExecute("G00 G53 X11.5 Y2.0")
GCodeExecute("G01 Z0.0 F50.0")
GCodeExecute("G00 G53 X11.5 Y61.0")
GCodeExecute("G00 G53 X18.0 Y61.0")
GCodeExecute("G00 G53 X18.0 Y2.0")
GCodeExecute("G00 G53 X27.0 Y2.0")
GCodeExecute("G00 G53 X27.0 Y61.0")
GCodeExecute("G00 G53 X36.0 Y61.0")
GCodeExecute("G00 G53 X36.0 Y2.0")
GCodeExecute("G00 G53 X45.0 Y2.0")
GCodeExecute("G00 G53 X45.0 Y61.0")
GCodeExecute("G00 G53 X54.0 Y61.0")
GCodeExecute("G00 G53 X54.0 Y2.0")
GCodeExecute("G00 G53 X63.0 Y2.0")
GCodeExecute("G00 G53 X63.0 Y61.0")
GCodeExecute("G00 G53 X72.0 Y61.0")
GCodeExecute("G00 G53 X72.0 Y2.0")
GCodeExecute("G00 G53 X81.0 Y2.0")
GCodeExecute("G00 G53 X81.0 Y61.0")
GCodeExecute("G00 G53 X90.0 Y61.0")
GCodeExecute("G00 G53 X90.0 Y2.0")
GCodeExecute("G00 G53 X99.0 Y2.0")
GCodeExecute("G00 G53 X99.0 Y61.0")
GCodeExecute("G00 G53 X104.5 Y61.0")
GCodeExecute("G00 G53 X104.5 Y2.0")
GCodeExecute("G00 G53 Z0.0")
GCodeExecute("M09") -- Dust Collector Off
GCodeExecute("G00 G53 X104.5 Y28.0") -- My park location
mc.mcCntlSetLastError(inst, "TableVac Done") -- Log Message
end -- if end MyChoice2
end -- if end MyChoice1
end -- function end
-- ========== End ===========
TableVac()