write a macro to do whatever you want and just call the macro from the user G-code. Mine is m111 below is the content of that macro open the script editor and past it in there, give it whatever number you want save it in the profile macros folder and just call that from the user gcode. mine is to use a touch plate so make sure you have that wired up before you try to use it.
function m111()
local touchplatethickness = .13 --Enter the thickness of your touchplate here.
local ProbeSpeed = 5 -- Enter how Fast the machine probes
local ProbeDistance = 4 -- How far it will go looking for the touch plate.
-------------------------End of User paramaters------------------------------
local inst = mc.mcGetInstance()
local probeHand, rc = mc.mcSignalGetHandle(inst,mc.ISIG_PROBE)
local probeState=mc.mcSignalGetState(probeHand)
if probeState==1 then
wx.wxMessageBox('Probe already active...cannot proceed')
return
end
mc.mcCntlGcodeExecuteWait(inst, "G01 G90 G31 Z-"..ProbeDistance.."F"..ProbeSpeed);
local zProbeStrikePos = mc.mcCntlGetPoundVar(inst, 5063);
mc.mcAxisSetPos(inst, 2, touchplatethickness);
mc.mcCntlGcodeExecuteWait(inst, 'G0 G91 Z1'); --Rapid move to 1 inch above current pos
probeState=mc.mcSignalGetState(probeHand)
if probeState == 1 then
wx.wxMessageBox("Probe is still activated! Check to make sure probe is not damaged or still contacting strike plate.");
else
mc.mcCntlSetLastError(inst, "Z Axis now referenced.");
end
end