diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 037c8c9..8a3b17b 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -1333,13 +1333,11 @@ 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++){ @@ -1347,25 +1345,19 @@ function onOpen() { } } - // also maybe anonymous - // TODO: tool.getNumberOfTools needs to be machine-specific constant - function invalidToolNum(toolNum) { + function validateToolNum(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 (invalidToolNum(parseInt(numRange[0])) || invalidToolNum(parseInt(numRange[1]))) { + if (validateToolNum(parseInt(numRange[0])) || validateToolNum(parseInt(numRange[1]))) { defaultFill(); break; } @@ -1374,12 +1366,10 @@ function onOpen() { } continue; } - // check if valid num - if (invalidToolNum(parseInt(toolNumArray[i]))) { + if (validateToolNum(parseInt(toolNumArray[i]))) { defaultFill(); break; } - // push single num parsedTools.push(parseInt(toolNumArray[i])); } } else { @@ -1437,8 +1427,6 @@ function onOpen() { writeln(""); writeComment("SETUP FOR OPERATION"); writeBlock(mFormat.format(131)); - } else { - writeComment("SETUP FOR OPERATION"); } if (staticProperties.useDWO) { @@ -2417,7 +2405,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) {