Probe result to offset write
Turn a measured value and nominal into the offset write line: #5221-style variable assignment or G10 L2, L20, L10 to L13 block for work offsets, G54.1 P offsets and tool length or radius wear on Fanuc, Haas and Mazak.
Probe result to offset write
You have a measured value and a nominal. This gives you the exact line to write the correction into a work offset or a tool offset, as a #variable assignment and as a G10 block.
#5221 = #5221 + 0.0032G10 G91 L2 P1 X0.0032Fanuc: tool offset addresses depend on offset memory type and count. Pick the memory layout that matches your control.
Deviation = measured − nominal, scaled by the feedback gain (100% applies it all, 50% walks in half at a time).
Work offsets: #5221 + 20·(n−1) + axis for G54 to G59 (X = 0, Y = 1, Z = 2). G54.1 Pn: #7001 + 20·(n−1) + axis, or #14001 base beyond P48. External offset: #5201+.
G10: G10 L2 Pn writes G54 to G59 (P0 is the external offset), G10 L20 Pn writes G54.1. G10 L10 / L11 / L12 / L13 P<tool> R<value> writes length geometry, length wear, radius geometry, radius wear. G90 before G10 sets the value, G91 adds to it.
Sign convention for tool wear: a feature that measures too big means the cutter is cutting big, so the radius wear moves negative by the deviation. A surface that measures high (positive Z) means the tool is cutting short, so length wear moves positive. Check this against your first part, conventions flip with how you define nominal.
Write offsets from a program only inside a macro you have single-blocked once. A wrong sign on a work offset write is a crash on the next rapid. Set the decimal places to match the control's input units.
Related tools
More in CNC programming & probing: G-code explainer & checker, Fanuc Macro B reference, Probing & tool setting cycle finder
Inspection, FAI & Reverse Engineering
Need a first article checked or a drawing cleaned up? I do that.