Hello Guest it is October 17, 2019, 02:07:40 AM

Author Topic: Retract button in Router.set  (Read 660 times)

0 Members and 1 Guest are viewing this topic.

Retract button in Router.set
« 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.
Re: Retract button in Router.set
« Reply #1 on: January 18, 2018, 06:51:09 AM »
Hi,
I take it your spindle is on the Zaxis, try this script with your 'go to work zero' button.

Code: [Select]
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!
Re: Retract button in Router.set
« Reply #2 on: January 18, 2018, 12:28:07 PM »
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