Hi @peter ,
I hope you're doing well. According to your need, you'll need to make 4 key modifications to your post. I'll walk you through them.
Modification 1:

First, you want to add the following code in the designated area (please refer to the attached screenshot for the precise location):
rValueOffset: {
title: "R-Value Offset",
description: "Compensate R Value to Secondary Spindle",
group: "configuration",
type: "real",
range: [-360, 360],
value: 0,
scope: "post"
},
Modification 2:

Next, you'll want to add another block of code (again, refer to the second screenshot for the exact location):
var rOffsetFormat = createFormat({ decimals: 3, type: FORMAT_REAL, scale: DEG });
var rOffsetOutput = createOutputVariable(rOffsetFormat);
Modification 3:

You'll need to replace an existing block of code with the following one (please see the third screenshot for the correct location):
//Condition to add R Offset Value
if (getProperty("gotSecondarySpindle") == "true") {
var newRValue
newRValue = Number(rOffsetOutput.format(abc.z)) + Number(getProperty("rValueOffset"))
// Normalize newRValue to be within 0-360
if (newRValue < 0) {
newRValue += 360;
} else if (newRValue >= 360) {
newRValue -= 360;
}
skipBlock = _skipBlock;
writeBlock(
gMotionModal.format(0),
conditional(machineConfiguration.isMachineCoordinate(0), aOutput.format(abc.x)),
conditional(machineConfiguration.isMachineCoordinate(1), bOutput.format(getB(abc, currentSection))),
conditional(machineConfiguration.isMachineCoordinate(2), "M19 R" + zFormat.format(newRValue))
);
} else {
skipBlock = _skipBlock;
writeBlock(
gMotionModal.format(0),
conditional(machineConfiguration.isMachineCoordinate(0), aOutput.format(abc.x)),
conditional(machineConfiguration.isMachineCoordinate(1), bOutput.format(getB(abc, currentSection))),
conditional(machineConfiguration.isMachineCoordinate(2), cOutput.format(abc.z)))
}
Modification 4:

Finally, add this last block of code into your post (check the fourth screenshot for the specific location):
rOffsetFormat.setScale(-DEG)
rOffsetOutput.setCyclicLimit(360);
rOffsetOutput.setCyclicSign(1);
rOffsetOutput.setFormat(rOffsetFormat)
After you've made these modifications, select the post again. You should now be able to see a new Variable called "R Offset value". Any values added in the field will be included in the output as shown in the final screenshot.
I hope this helps! Please do not hesitate to reach out if you have any more questions or face any difficulties.

Aju Augustine
Technology Consultant