Hi @TIMISIONEL ,
To call Cancel tilt at the end of the operation and Activate WCS, Please create new function cancelWorkPlane() { and add it in function onSection() { as shown below,
function cancelWorkPlane() {
writeBlock(gFormat.format(80)); // cancel frame
forceWorkPlane();
}
function onSection() {
var insertToolCall = isFirstSection() ||
currentSection.getForceToolChange && currentSection.getForceToolChange() ||
(tool.number != getPreviousSection().getTool().number);
retracted = true; // specifies that the tool has been retracted to the safe plane ; // was false
var newWorkOffset = isFirstSection() ||
(getPreviousSection().workOffset != currentSection.workOffset); // work offset changes
var newWorkPlane = isFirstSection() ||
!isSameDirection(getPreviousSection().getGlobalFinalToolAxis(), currentSection.getGlobalInitialToolAxis()) ||
(currentSection.isOptimizedForMachine() && getPreviousSection().isOptimizedForMachine() &&
Vector.diff(getPreviousSection().getFinalToolAxisABC(), currentSection.getInitialToolAxisABC()).length > 1e-4) ||
(!machineConfiguration.isMultiAxisConfiguration() && currentSection.isMultiAxis()) ||
(!getPreviousSection().isMultiAxis() && currentSection.isMultiAxis()); // force newWorkPlane between indexing and simultaneous operations
if (insertToolCall || newWorkOffset || newWorkPlane) {
cancelWorkPlane(); // add code to call G80
// retract to safe plane
writeRetract(Z);
writeBlock(gAbsIncModal.format(90));
}
Now Go to function setWorkPlane(abc) {
// NOTE: add retract here
writeBlock(
gMotionModal.format(0),
conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
);
//add below codes *****
writeBlock(
gFormat.format(80),
conditional(machineConfiguration.isMachineCoordinate(0), "A" + abcFormat.format(abc.x)),
conditional(machineConfiguration.isMachineCoordinate(1), "B" + abcFormat.format(abc.y)),
conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(abc.z))
);
// ****
Now add Cancel workplane code in the function onClose() {
function onClose() {
onCommand(COMMAND_COOLANT_OFF);
cancelWorkPlane(); // add code to cancel workplane
writeRetract(Z);
Now save the post and test it carefully.
Also, We can configure the post same like your PEPS-OK output. For that we need to call preposition of XYZ with workplace and need to add more codes.
Thanks,
Krupal Vala
Senior Technology Consultant - Post Processor & Machine Simulation