diff --git a/Haas_Gantry_BIDC/Bechtel SR.cps b/Haas_Gantry_BIDC/Bechtel SR.cps index 38d9c2b..e0ef7a6 100644 --- a/Haas_Gantry_BIDC/Bechtel SR.cps +++ b/Haas_Gantry_BIDC/Bechtel SR.cps @@ -171,7 +171,7 @@ properties = {/* {title: "Cycles", id: "cycles"}, {title: "Patterns", id: "patterns"} ], - value: "allOperations", + value: "none", scope: "post" },/* useG187: { @@ -260,6 +260,14 @@ properties = {/* value: true, scope: "post" }*/ + toolsToLoad: { + title: "Tools to load and probe", + description: "List or provide a range of tools to probe e.g. 1, 2, 3 or 1-5. Leaving this empty will probe all tools", + group: 4, + type: "string", + value: "", + scope: "post" + }, pencilWCSValidation: { title: "WCS Validation", description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", @@ -281,7 +289,7 @@ properties = {/* description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: false, + value: true, scope: "post" } }; @@ -905,11 +913,59 @@ function onOpen() { writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); */ + parsedTools = [] + + function defaultFill() { + for (var i = 0; i < tools.getNumberOfTools(); i++){ + parsedTools[i] = tools.getTool(i).number; + } + } + + function invalidToolNum(toolNum) { + return (toolNum < 1 || toolNum > 10); + } + // 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]))) { + defaultFill(); + break; + } + for(var j = numRange[0]; j <= numRange[1]; j++){ + parsedTools.push(parseInt(j)); + } + continue; + } + // check if valid num + if (invalidToolNum(parseInt(toolNumArray[i]))) { + defaultFill(); + break; + } + // push single num + parsedTools.push(parseInt(toolNumArray[i])); + } + } else { + defaultFill(); + } + for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); if (staticProperties.optionallyMeasureToolsAtStart && (tool.type == TOOL_PROBE)) { continue; } + + if (parsedTools.indexOf(tool.number) <= -1) { + continue; + } + var comment = "T" + toolFormat.format(tool.number) + " " + "D=" + xyzFormat.format(tool.diameter) + " " + localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); diff --git a/Haas_Mills_BIDC/Bechtel DT.cps b/Haas_Mills_BIDC/Bechtel DT.cps index 2a04feb..a7d8a35 100644 --- a/Haas_Mills_BIDC/Bechtel DT.cps +++ b/Haas_Mills_BIDC/Bechtel DT.cps @@ -515,6 +515,8 @@ staticProperties = { const X_TRAVEL_LIMIT = -20; const Y_TRAVEL_LIMIT = -16; + const MAX_TOOL_NUM = 20; + var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines // samples: // {id: COOLANT_THROUGH_TOOL, on: 88, off: 89} @@ -1367,7 +1369,7 @@ function onOpen() { // 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); + return (toolNum < 1 || toolNum > MAX_TOOL_NUM); } // parse string for specific tools to load @@ -2815,6 +2817,7 @@ function onSection() { if (tool.type != TOOL_PROBE) { setCoolant(tool.coolant); + writeBlock(gFormat.format(4), "P500"); } writeComment("BEGIN OPERATION"); diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 108f24e..b46e4c2 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -515,6 +515,8 @@ staticProperties = { const X_TRAVEL_LIMIT = -30; const Y_TRAVEL_LIMIT = -15; + const MAX_TOOL_NUM = 20; + var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines // samples: // {id: COOLANT_THROUGH_TOOL, on: 88, off: 89} @@ -1367,7 +1369,7 @@ function onOpen() { // 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); + return (toolNum < 1 || toolNum > MAX_TOOL_NUM); } // parse string for specific tools to load @@ -2815,6 +2817,7 @@ function onSection() { if (tool.type != TOOL_PROBE) { setCoolant(tool.coolant); + writeBlock(gFormat.format(4), "P500"); } writeComment("BEGIN OPERATION"); diff --git a/Haas_Mills_BIDC/Bechtel VF4.cps b/Haas_Mills_BIDC/Bechtel VF4.cps index 882c1c2..7522560 100644 --- a/Haas_Mills_BIDC/Bechtel VF4.cps +++ b/Haas_Mills_BIDC/Bechtel VF4.cps @@ -515,6 +515,7 @@ staticProperties = { const X_TRAVEL_LIMIT = -50; const Y_TRAVEL_LIMIT = -20; + const MAX_TOOL_NUM = 20; var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines // samples: // {id: COOLANT_THROUGH_TOOL, on: 88, off: 89} @@ -1367,7 +1368,7 @@ function onOpen() { // 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); + return (toolNum < 1 || toolNum > MAX_TOOL_NUM); } // parse string for specific tools to load