Hey, everybody.
I've tweaked the macros found on the forum a bit to use two sensors.
It was pretty hard for me to figure it all out from scratch, plus there are a lot of variations on the forum, so I decided to post my version here - maybe it will help someone.
My tool sensor is located in the corner of the work area, it is fixed and calibrated so that its surface is parallel to the table.
When I set up a workpiece, I put a sensor in the spindle instead of the cutter, and use it and the probing section to set the workpiece zero in X and Y. Then I run the M31 script from the button on the main screen, and it first measures Z underneath itself, then goes to the tool sensor and measures there. I save the difference of these values as coordinate C. Then the spindle shifts to the convenient tool change position, where I remove the sensor and insert the cutter.
Then I load my g-code, and when it encounters the M6 tool change command, the manual change script is run. The script first brings the cutter to the tool change area, moves the spindle over the tool sensor when you press the button in the window that appears, and after you agree that the sensor is working, takes a measurement. The measured value is corrected by the pre-stored difference between the workpiece zero and the sensor, so that the ready coordinates are recorded and you do not need to do anything. It then returns the spindle to the last point (if you have multiple tool changes in your code, it will return it to where you left off, and the tip of the cutter will be at the same height as the tip of the last tool).
I bought the sensors from the Belarusian company https://vers.by/, and I like the way they work. It only cost about $240 for two wired sensors, and these sensors have many advantages - you don't risk breaking the cutter against a hard plate, you see a light on the sensors about the fact that they are working or touching. This is not an advertisement, lots of people make similar sensors, like eabrust(http://www.craftycnc.com/touch-probes/) or a bunch on aliexpress.
I also recommend installing a led #37 somewhere on the main screen so you can check the sensors if you have them without a light bulb. I had a situation once where the sensor wires shorted and the cutter punctured it...
Also sorry for the Russian comments in the code, google translate will help you understand them - I do not know English well enough to translate them correctly.