From 9ed4d6e1f50e2e6b53da15199c4951d251afd967 Mon Sep 17 00:00:00 2001 From: will1742 Date: Thu, 2 Sep 2021 15:03:13 -0400 Subject: [PATCH] Mapped linear movement params --- Flow_Waterjet_BIDC/Bechtel Waterjet.cps | 64 ++++++++++++++++++++----- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps index 6825626..95755f7 100644 --- a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps +++ b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps @@ -120,6 +120,17 @@ function f(text) { return FIELD.substr(0, 10 - length) + text; } +var commentField = "// "; + +/** Make sure fields are aligned. */ +function commentf(text) { + var length = text.length; + if (length > 10) { + return text; + } + return commentField.substr(0, 10 - length) + text; +} + /** Make sure fields are aligned. */ function fi(text, size) { var length = text.length; @@ -130,7 +141,7 @@ function fi(text, size) { } function onOpen() { - useVersion6 = getProperty("formatVersion") == "6"; + useVersion6 = true; unit = IN; // only inch mode is supported redirectToBuffer(); // buffer the entire program to be able to count the linear and circular moves @@ -207,6 +218,13 @@ 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); } @@ -227,6 +245,25 @@ function writeLinear(x, y, z, feed, column7) { if (flag || forceOutput) { if (useVersion6) { + switch (writeLinear.caller.name) { + case "onRapid": + writeComment("Rapid"); + break; + case "onLinear": + writeComment("Linear"); + break; + case "finishArcs": + writeComment("Arc Completion"); + break; + } + 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)), ",", @@ -237,6 +274,18 @@ function writeLinear(x, y, z, feed, column7) { fi(integerFormat.format(column7), 2) // TAG: seen -2..2 - unknown ); } else { + switch (writeLinear.caller.name) { + case "onRapid": + writeComment("Rapid"); + break; + case "onLinear": + writeComment("Linear"); + break; + case "finishArcs": + 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)), ",", @@ -292,6 +341,8 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { } var p = getCurrentPosition(); if (useVersion6) { + writeComment("Circular"); + writeBlock( f(xyzFormat.format(p.x)), ",", f(xyzFormat.format(p.y)), ",", @@ -305,6 +356,7 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { f(xyzFormat.format(0)) // PLANE_XY only ); } else { + writeComment("Circular"); writeBlock( f(xyzFormat.format(p.x)), ",", f(xyzFormat.format(p.y)), ",", @@ -389,16 +441,6 @@ function onClose() { writeComment("Filename: " + getGlobalParameter("document-path")); writeComment("Date: " + getGlobalParameter("generated-at")); writeComment("Post Version: " + staticProperties.postVersion); - writeln(""); - writeBlock( - "//"," Start X", ",", - f("Start Y"), ",", - fi(" Arc"), ",", // arc cw/ccw - fi(" Feed"), ",", - fi(" Comp"), ",", // left, center, right - f("End X"), ",", - f("End Y") - ); // writeln("// This file was created by FlowMaster(R), which is proprietary to Flow International Corporation. " + lineCounter + " " + arcCounter); if (useVersion6) { writeln("VER 6.00");