Skip to content

Commit

Permalink
Merge branch 'Gavin' into Kevin
Browse files Browse the repository at this point in the history
  • Loading branch information
pan261 committed Sep 2, 2021
2 parents dffdcf0 + 4732f1d commit da1c89f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
42 changes: 40 additions & 2 deletions Flow_Waterjet_BIDC/Bechtel Waterjet.cps
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ maximumCircularSweep = toRad(90);
allowHelicalMoves = false;
allowedCircularPlanes = 1 << PLANE_XY; // allow only XY circular motion

var maximumLineLength = 80; // the maximum number of charaters allowed in a line

// formatVersion:
// version 6 should be user selectable, but now use version 5
// version 5 does not have z moves, so it will be safer for inexperienced users
Expand Down Expand Up @@ -69,6 +71,10 @@ properties = {
}
};

staticProperties = {
postVersion: "BIDC-FWJ.G8.A21"
};

// use fixed width instead
var xyzFormat = createFormat({decimals:4, trim:false});
var integerFormat = createFormat({decimals:0});
Expand All @@ -95,6 +101,14 @@ function writeBlock() {
writeWords(arguments);
}

function formatComment(comment) {
return "// " + comment;
}

function writeComment(text) {
writeln(formatComment(text.substr(0, maximumLineLength - 2)));
}

var FIELD = " ";

/** Make sure fields are aligned. */
Expand Down Expand Up @@ -361,11 +375,35 @@ function onClose() {
if (isRedirecting()) {
var mainProgram = getRedirectionBuffer(); // TAG: no need for redirection
closeRedirection();
writeln("// This file was created by FlowMaster(R), which is proprietary to Flow International Corporation. " + lineCounter + " " + arcCounter);
if (programName) {
var programId;
try {
programId = getAsInt(programName);
} catch (e) {
error(localize("Program name must be a number."));
return;
}
}
writeComment("O" + programId);
writeComment("Career Account Username: " + getGlobalParameter("username"));
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");
}
writeln("// Created by Autodesk HSM");
// writeln("// Created by Autodesk HSM");
if (programComment) {
writeln("// " + programComment);
}
Expand Down
20 changes: 16 additions & 4 deletions Haas_Mills_BIDC/Bechtel VF2.cps
Original file line number Diff line number Diff line change
Expand Up @@ -1333,31 +1333,39 @@ function onOpen() {
// 6/21/21 | Gavin Williams | will1742
writeComment("Load and probe tools");

// Display general tool probe info
displayMedia("toolProbeReminder.jpg");
writeBlock(mFormat.format(0));

let parsedTools = [];

// Maybe should be anonymous function??
function defaultFill() {
parsedTools = []
for (var i = 0; i < tools.getNumberOfTools(); i++){
parsedTools[i] = tools.getTool(i).number;
}
}

function validateToolNum(toolNum) {
// also maybe anonymous
// TODO: tool.getNumberOfTools needs to be machine-specific constant
function invalidToolNum(toolNum) {
return (toolNum < 1 || toolNum > tools.getNumberOfTools() || tools.getTool(toolNum) == undefined);
}

// parse string for specific tools to load
if (getProperty("toolsToLoad") != "") {
// get list of numbers
let toolNumArray = getProperty("toolsToLoad").split(',');
// iterate through and fill ranges
for (var i = 0; i < toolNumArray.length; i++){
toolNumArray[i] = toolNumArray[i].trim();
// fill range
if (toolNumArray[i].indexOf("-") >= 0) {
let numRange = toolNumArray[i].split("-");
if (validateToolNum(parseInt(numRange[0])) || validateToolNum(parseInt(numRange[1]))) {
if (invalidToolNum(parseInt(numRange[0])) || invalidToolNum(parseInt(numRange[1]))) {
defaultFill();
break;
}
Expand All @@ -1366,10 +1374,12 @@ function onOpen() {
}
continue;
}
if (validateToolNum(parseInt(toolNumArray[i]))) {
// check if valid num
if (invalidToolNum(parseInt(toolNumArray[i]))) {
defaultFill();
break;
}
// push single num
parsedTools.push(parseInt(toolNumArray[i]));
}
} else {
Expand Down Expand Up @@ -1427,6 +1437,8 @@ function onOpen() {
writeln("");
writeComment("SETUP FOR OPERATION");
writeBlock(mFormat.format(131));
} else {
writeComment("SETUP FOR OPERATION");
}

if (staticProperties.useDWO) {
Expand Down Expand Up @@ -2405,7 +2417,7 @@ function onSection() {
}

if (hasParameter("notes") && getParameter("notes").toUpperCase().indexOf("APPROVED") <= -1) {
throw "Operation \"" + getParameter("operation-comment") + "\" not approved. See a Peer Mentor."
// throw "Operation \"" + getParameter("operation-comment") + "\" not approved. See a Peer Mentor."
}

if (staticProperties.showNotes) {
Expand Down

0 comments on commit da1c89f

Please sign in to comment.