Yes, you could write it to [save_variables]. You can store whole objects in there so you could keep an object for each tool and use whatever settings you need when tools change. I made a post about this a while back.
Yes…
I have a mcro on the test machine that can do this:
[gcode_macro _SET_OFFSET_FROM_PROBE]
gcode:
{% set z_offset = printer.probe.last_z_result | abs %}
{ action_respond_info('Probe Offset calibrated: %.5fmm' % (z_offset)) }
SET_GCODE_OFFSET Z={z_offset}
However, you have to call this macro from the macro with the PROBE
call in it. You cannot put everything into 1 macro. Because of how macro evaluation works, the result of the PROBE
is never available to the currently executing macro.
(Macros use a templating engine, your macro is a template and behaves like one. All variable substitution happens in 1 pass when the macro starts, then the code executes)