I understand that you want to save the value of the variable "R" to some of the current number of the correction. Well I think? (my English is poor).
Well here we go:
I see it like this:
Code:
;ISO G-Code Program
;G90 G00 G94 G17 G64
T4 D9 M6;CALL TOOLS, CALLING THE CORRECTION NUMBER AND TOOL CHANGE
; $TC_DP6[m,n] - RADIUS GEOMETRY; m-tool number in whole mag table, n-"D" Number
; $TC_DP15[m,n] - RADIUS FINE; m-tool number in whole mag table, n-"D" Number
; $TC_DP3[m,n] - LENGTH GEOMETRY; m-tool number in whole mag table, n-"D" Number
; $TC_DP12[m,n] - FINE LENGTH; m-tool number in whole mag table, n-"D" Number
; $TC_MPP6[9998,1]-Table number actual tools (T4-not necessarily 4)
; $SP_TOOL - actual tools "D" number (should be 9)
; if
; r3 = 100; r4 =-0.1; r5 =-0.1
; when
; r3 = r3 + r4 + r5
; r3 = 99.8
; r4 = 0
;Logical? :)
;And so:
;Example for RADIUS
$TC_DP6[$TC_MPP6[9998,1], $SP_TOOL] = $TC_DP6[$TC_MPP6[9998,1], $SP_TOOL] + $TC_DP15 [$TC_MPP6[9998,1], $SP_TOOL] + R5
$TC_DP15[$TC_MPP6[9998,1], $SP_TOOL] = 0
;Example for length.
$TC_DP3[$TC_MPP6[9998,1], $SP_TOOL] = $TC_DP3[$TC_MPP6 [9998,1], $SP_TOOL] + $TC_DP12 [$TC_MPP6[9998,1], $SP_TOOL] + R5
$TC_DP12[$TC_MPP6[9998,1], $SP_TOOL] = 0
; After you make changes you will need to call again.
D9
or
G1 G41 D9 X 10
.....
.....
....
M17