I have a floating head plasma torch mount with Proximity switch to be used for two purposes.  1: Sense material height during M3 Probing/start torch and 2: Use as protection against torch damage from collision during cutting. I have the following “work in progress” where I’ve added code to  signal library, and monitor the Probe/collision input signal.  The plan is to check to see if were performing an M3 move, and if we are, do nothing otherwise, do a STOPmovement().
I unsuccessfully placed a M3Probing variable in the M3 Macro to =1 when performing probing, but I can’t figure out how to get the signal Library code to see the variable.  The scripting manual says the variable has to be in a Module to share it between macros and signal library, but everything I’ve tried has failed.
Can someone point me in the right direction?
Thanks.
--Signal Library Code
[mc.ISIG_INPUT9]= function (state) -- Torch Probe/collision switch state has changed
	if(state==1) then 
		If (M3Probing==1) then  -- THIS VARIABLE IS SUPPOSED TO BE SET BY m3() However it is not seen by this signal library code, so it does not work.
			--do nothing
		Else
			STOPmovement() -- call function to stop movement
			mc.mcCntlSetLastError(inst, "Error- Torch Collision Detected")  -- Put message in message box
		End
	end
end,
-- added function to bottom of screen script
function STOPmovement ()
	local inst = mc.mcGetInstance()
	mc.mcSpindleSetDirection(inst,0)  -- Set to 0 to turn spindle off
	mc.mcCntlCycleStop(inst)  -- stops Gcode file that is running.
end