Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Peter Knell on January 18, 2018, 01:09:36 AM
-
hey guys. Ive finally ventured to another screenset from the wx4 and i like the router one. As i havent learnt Lua can someone please tell me what i need in left up or down screen load so that when i hit the retract button my spindle will retract to machine cord. Zero? I have set up my 'go to work zero' button so i have a small idea just need code and which load to put it under? Any help much appreciated.
-
Hi,
I take it your spindle is on the Zaxis, try this script with your 'go to work zero' button.
local inst = mc.mcGetInstance()
local executeGcode = ("G00 G53 Z0.0000\n") --use machine coords (G53)
mc.mcCntlMdiExecute(inst, executeGcode)
mc.mcCntlSetLastError(inst, "Moving Zaxis to zero using Machine Coords")
Good Luck!
-
Thanks Dazed
I see there is already this code in the screen load script for the retract button. Shouldnt it read this and move my z axis up? Its not commented out.
----------------------------------------
-- Retract added 9/19/2016
----------------------------------------
function SetRetractCode()
local inst = mc.mcGetInstance();
local hReg = mc.mcRegGetHandle(inst, "/core/inst/RetractCode");
mc.mcRegSetValueString(hReg, "G80G40G90G20\\nG53 G00 Z0\\nM5\\nG53 G00 X0Y0"); --This is the Gcode string that will be executed when retract is requested
end