Skip to content

Commit

Permalink
Mapped linear movement params
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Sep 2, 2021
1 parent c10b612 commit 9ed4d6e
Showing 1 changed file with 53 additions and 11 deletions.
64 changes: 53 additions & 11 deletions Flow_Waterjet_BIDC/Bechtel Waterjet.cps
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);
}
Expand All @@ -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)), ",",
Expand All @@ -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)), ",",
Expand Down Expand Up @@ -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)), ",",
Expand All @@ -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)), ",",
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 9ed4d6e

Please sign in to comment.