Skip to content

Commit

Permalink
Added Debug Mode and Feed Cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Sep 16, 2021
1 parent d584dba commit a6a840a
Showing 1 changed file with 49 additions and 32 deletions.
81 changes: 49 additions & 32 deletions Flow_Waterjet_BIDC/Bechtel Waterjet.cps
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ longDescription = "Post for Flow Waterjets using software Version 5 or 6. V5=2-a
"V5: Manually set nozzle height. V6: Nozzle height in NC program set by Top Height attribute. " + EOL +
"Feed percentage set by Cutting Mode quality in tool dialog (auto=60, high=20, medium=40, low=100)";

extension = "ORD";
extension = "ord";
setCodePage("ascii");

capabilities = CAPABILITY_JET;
Expand Down Expand Up @@ -68,6 +68,13 @@ properties = {
],
value: "6",
scope: "post"
},
debugMode: {
title: "Debug Mode",
description: "Display Comments in ORD. Not compatible with machine",
type: "boolean",
value: false,
scope: "post"
}
};

Expand All @@ -87,6 +94,8 @@ var lineCounter = -1;
// collected state
var useVersion6 = false;
var arcFinish = undefined;
var feedActive = false;
var prevCoords = undefined;

// override radius compensation
var compensationOffset = 0; // center compensation
Expand All @@ -106,6 +115,7 @@ function formatComment(comment) {
}

function writeComment(text) {
if (!getProperty("debugMode")) return;
writeln(formatComment(text.substr(0, maximumLineLength - 2)));
}

Expand Down Expand Up @@ -218,13 +228,6 @@ function onSection() {
return;
}

if (hasParameter("operation-comment")) {
var comment = getParameter("operation-comment");
writeln("");
writeComment(comment);
} else {
writeln("");
}
var initialPosition = getFramePosition(currentSection.getInitialPosition());
onExpandedRapid(initialPosition.x, initialPosition.y, initialPosition.z);
}
Expand Down Expand Up @@ -256,14 +259,16 @@ function writeLinear(x, y, z, feed, column7) {
writeComment("Arc Completion");
break;
}
writeBlock(
commentf("X"), ",",
f("Y"), ",",
f("Z"), ",",
fi("L", 2), ",",
fi("Feed", 5), ",",
fi("C", 2), ",",
fi("?", 2));
if (getProperty("debugMode")){
writeBlock(
commentf("X"), ",",
f("Y"), ",",
f("Z"), ",",
fi("L", 2), ",",
fi("Feed", 5), ",",
fi("C", 2), ",",
fi("?", 2));
}
writeBlock(
f(xyzFormat.format(x)), ",",
f(xyzFormat.format(y)), ",",
Expand All @@ -285,7 +290,6 @@ function writeLinear(x, y, z, feed, column7) {
writeComment("Arc Completion");
break;
}
writeBlock(commentf("X"), ",", f("Y"), ",", fi("L", 2), ",", fi("Feed", 5), ",", fi("C", 2))
writeBlock(
f(xyzFormat.format(x)), ",",
f(xyzFormat.format(y)), ",",
Expand All @@ -297,7 +301,10 @@ function writeLinear(x, y, z, feed, column7) {
++lineCounter;
forceOutput = false;
}

if (feed > 0) {
feedActive = true;
}
prevCoords = {x:x, y:y, z:z};
}

function finishArcs() {
Expand All @@ -311,7 +318,12 @@ function finishArcs() {

function onRapid(x, y, z) {
finishArcs();
if (feedActive) {
forceOutput = true;
writeLinear(prevCoords.x, prevCoords.y, prevCoords.z, 0, 0);
}
writeLinear(x, y, z, 0, 0); // non-cutting
feedActive = false;
}

function onLinear(x, y, z, feed) {
Expand Down Expand Up @@ -342,17 +354,19 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
var p = getCurrentPosition();
if (useVersion6) {
writeComment("Circular");
writeBlock(
commentf("X"), ",",
f("Y"), ",",
f("Z"), ",",
fi("CW", 2), ",",
fi("Feed", 5), ",",
fi("C", 2), ",",
fi("?", 2), ",",
f("CX"), ",",
f("CY"), ",",
f("CZ"));
if (getProperty("debugMode")){
writeBlock(
commentf("X"), ",",
f("Y"), ",",
f("Z"), ",",
fi("CW", 2), ",",
fi("Feed", 5), ",",
fi("C", 2), ",",
fi("?", 2), ",",
f("CX"), ",",
f("CY"), ",",
f("CZ"));
}
writeBlock(
f(xyzFormat.format(p.x)), ",",
f(xyzFormat.format(p.y)), ",",
Expand Down Expand Up @@ -381,7 +395,10 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {

// save destination values to complete arc move
arcFinish = {x:x, y:y, z:z, feed:(power ? getFeedInPercent(feed) : 0)};

if (feed > 0) {
feedActive = true;
}
prevCoords = {x:x, y:y, z:z};
}

function getFeedInPercent(feed) {
Expand Down Expand Up @@ -451,11 +468,11 @@ function onClose() {
writeComment("Filename: " + getGlobalParameter("document-path"));
writeComment("Date: " + getGlobalParameter("generated-at"));
writeComment("Post Version: " + staticProperties.postVersion);
// writeln("// This file was created by FlowMaster(R), which is proprietary to Flow International Corporation. " + lineCounter + " " + arcCounter);
writeln("// This file was created by FlowMaster(R), which is proprietary to Flow International Corporation. " + lineCounter + " " + arcCounter);
if (useVersion6) {
writeln("VER 6.00");
}
// writeln("// Created by Autodesk HSM");
writeln("// Created by Autodesk HSM");
if (programComment) {
writeln("// " + programComment);
}
Expand Down

0 comments on commit a6a840a

Please sign in to comment.