diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 8a3b17b..037c8c9 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -1333,11 +1333,13 @@ 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++){ @@ -1345,19 +1347,25 @@ function onOpen() { } } - 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; } @@ -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 { @@ -1427,6 +1437,8 @@ function onOpen() { writeln(""); writeComment("SETUP FOR OPERATION"); writeBlock(mFormat.format(131)); + } else { + writeComment("SETUP FOR OPERATION"); } if (staticProperties.useDWO) { @@ -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) {