From a6a840a000e7df5116616cadd3afa16bcb645b79 Mon Sep 17 00:00:00 2001 From: will1742 Date: Thu, 16 Sep 2021 14:12:04 -0400 Subject: [PATCH] Added Debug Mode and Feed Cancel --- Flow_Waterjet_BIDC/Bechtel Waterjet.cps | 81 +++++++++++++++---------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps index 05ad654..57fd684 100644 --- a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps +++ b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps @@ -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; @@ -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" } }; @@ -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 @@ -106,6 +115,7 @@ function formatComment(comment) { } function writeComment(text) { + if (!getProperty("debugMode")) return; writeln(formatComment(text.substr(0, maximumLineLength - 2))); } @@ -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); } @@ -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)), ",", @@ -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)), ",", @@ -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() { @@ -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) { @@ -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)), ",", @@ -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) { @@ -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); }