Looking good
I have a subroutine called "HeightSense.tap" that has something like this in it...
G91 (switch to incremental mode)
G01 X28.00 Y4.00 F6000 (position probe switch)
G90 (switch to absolute mode)
M1050 (trigger the probe cylinder)
G28.1 Z5.000 (probe the surface)
G92 Z0.000 (zero the Z axis DRO)
M1051 (raise the probe)
G00 Z#15045 (apply the probe switch offset from M6 tool change)
G92 Z0.000 (zero the Z axis)
G00 Z5.00 (raise the Z axis for travel)
G91 (switch to incremental mode)
G01 X-28.00 Y-4.00 F6000 (put the axes back to where we came from)
G90 (switch to absolute mode)
M99
%
All the codes were pulled from SheetCam and now it just calls heightsense.tap where it needs to do the probing - no more messing with all my code files when i change the switch position etc
M1050/M1051 just activate/deactivate the output that has the cylinder solenoid on it.
My switch is a very low force one - about 10g force - i can sense the height of very thin material without moving it.
The tool change M6 bit has two offsets in it - one for 30A tips and one for 45A ones, I have a button on screen that just alternates between each tip and tells me what i have installed.