Thanks for you offer to work with us on fine tuning the part transfer logic. The part transfer code in the post reflects work done with different users when creating the post and cannot be changed in the stock post, since it would adversely affect customers currently using the post. For the spindle speed issues, the post is designed to use the spindle mode/speed/direction from the cutoff operation so that it does not change after/during the part transfer and part cutoff. I realize that not everyone utilizes the same procedures for part transfers, either by preference or machine capabilities, so in these cases it does require that the post be modified.
Here are the modifications that I made to get your desired output. For me, I did not have a problem with cycle.spindleOrientation, please try these changes and see if it is working for you. I did not add comments to all of the blocks output for the transfer operations, but you can do this by adding formatComment("comment") style code to the appropriate writeBlock calls.
First, at the top of the post add the following line.
// synchronized spindle start parameters
var SYNC_ERROR = 0;
var SYNC_UNCLAMP = 1;
var SYNC_SPEED = 2;
var SYNC_DEFAULT = 3;
And modify the following line.
var syncStartMethod = SYNC_DEFAULT; // method used to output spindle block when they are already synched/connected
In the onCycle function, comment out the following code.
writeBlock(feedMode, gPlaneModal.format(18)/*, cAxisEngageModal.format(getCode("DISABLE_C_AXIS", getSpindle(PART)))*/);
// writeBlock(mFormat.format(getCode("DISABLE_C_AXIS", getSecondarySpindle())));
In the "secondary-spindle-return" case in the onCycle function, add the following code. You can comment out the onDwell calls also if you like.
// Transfer part to secondary spindle
if (cycle.unclampMode != "keep-clamped") {
secondaryPull = feedDis != 0;
secondaryHome = true;
} else {
// pull part only (when offset!=0), Return secondary spindle to home (when offset=0)
secondaryPull = feedDis != 0;
secondaryHome = !secondaryPull;
}
var transferCodes = getSpindleTransferCodes(transferType);
var code = getCode("SPINDLE_SYNCHRONIZATION_SPEED", getSecondarySpindle());
if (!transferCodes.spindleDirection) {
code += 1;
}
gSpindleModeModal.reset();
writeBlock(
gSpindleModeModal.format(getCode("CONSTANT_SURFACE_SPEED_OFF", getSpindle(PART))),
sOutput.format(cycle.spindleSpeed),
mFormat.format(code),
formatComment("SPEED SYNCHRONIZATION")
);
// writeBlock(mFormat.format(getCode("INTERLOCK_BYPASS", getSecondarySpindle())));
...
...
} else {
clampChuck(getSpindle(PART), CLAMP);
onDwell(cycle.dwell);
// writeBlock(mFormat.format(getCode("COOLANT_THROUGH_TOOL_OFF", getSecondarySpindle())));
// mInterferModal.reset();
// writeBlock(mInterferModal.format(getCode("INTERFERENCE_CHECK_OFF", getSpindle(PART))));
}
machineState.stockTransferIsActive = true;
break;
And finally, replace the code in the "secondary-spindle-grab" section with the following logic.
case "secondary-spindle-grab":
if (currentSection.partCatcher) {
engagePartCatcher(true);
}
var transferCodes = getSpindleTransferCodes(transferType);
writeBlock(mFormat.format(getCode("ENABLE_C_AXIS", getSecondarySpindle())));
writeBlock(mFormat.format(getCode("UNLOCK_MULTI_AXIS", getSecondarySpindle())));
writeBlock(gFormat.format(28), "H" + abcFormat.format(0)); // unwind
writeBlock(mFormat.format(getCode("ENABLE_C_AXIS", getSpindle(PART))));
writeBlock(mFormat.format(getCode("UNLOCK_MULTI_AXIS", getSpindle(PART))));
writeBlock(gFormat.format(28), "H" + abcFormat.format(0)); // unwind
writeBlock(gFormat.format(54), gFormat.format(0), "C" + abcFormat.format(cycle.spindleOrientation));
writeBlock(mFormat.format(getCode("LOCK_MULTI_AXIS", getSpindle(PART))));
writeBlock(mFormat.format(getCode("INTERLOCK_BYPASS", getSecondarySpindle())), formatComment("INTERLOCK BYPASS"));
clampChuck(getSecondarySpindle(), UNCLAMP);
gSpindleModeModal.reset();
var code = getCode("SPINDLE_SYNCHRONIZATION_SPEED", getSecondarySpindle());
if (!transferCodes.spindleDirection) {
code += 1;
}
writeBlock(
gSpindleModeModal.format(getCode("CONSTANT_SURFACE_SPEED_OFF", getSpindle(PART))),
sOutput.format(cycle.spindleSpeed),
mFormat.format(code),
formatComment("SPEED SYNCHRONIZATION")
);
lastSpindleMode = SPINDLE_CONSTANT_SPINDLE_SPEED;
gMotionModal.reset();
moveSubSpindle(RAPID, cycle.feedPosition, 0, cycle.useMachineFrame, "", true);
moveSubSpindle(FEED, cycle.chuckPosition, cycle.feedrate, cycle.useMachineFrame, "", true);
clampChuck(getSecondarySpindle(), CLAMP);
machineState.stockTransferIsActive = true;
break;
These changes should get you the sample output that you provided. Let me know if you have any questions.
Thanks

Bob Schultz
Sr. Post Processor Developer