Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: cd_edwards on December 20, 2025, 07:22:40 AM
-
Any chance we can get multi-line gcode's working with the XHCWB04 plugin. Specifically in the Probe Z spot?
Something like G31Z-3F10\nG92Z0.2\nG1Z-1
Currently I seem to only be able to have G31Z-3F10 in there but of course that's not the whole story. Using a gauge block or a touch plate, it would be nice to set the Z coordinate to material top and then move Z up. I tried a semi-colon as well. What I posted above seems to want to drive into the table instead of providing what I was looking for.And yes I know about the User G Code. I added those three lines to a user gcode, but that also requires you to use the Fn button to use it. If it's already possible, maybe some documentation? just saying.
-
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