From dbc2daa1fd1ed4424cf2b13bd8be5b1020f12c04 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 2 Sep 2021 14:17:21 -0400 Subject: [PATCH 01/17] update on optional tool measure blocks Works when measureToolsAtStart is `false`, however doesn't work when it's `true` --- Haas_Mills_BIDC/Bechtel DT.cps | 4 +- Haas_Mills_BIDC/Bechtel VF2.cps | 87 +++++++++++++++++++++------------ 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/Haas_Mills_BIDC/Bechtel DT.cps b/Haas_Mills_BIDC/Bechtel DT.cps index 1a3bd87..d5352a4 100644 --- a/Haas_Mills_BIDC/Bechtel DT.cps +++ b/Haas_Mills_BIDC/Bechtel DT.cps @@ -436,7 +436,7 @@ properties = {/* description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: true, + value: false, scope: "post" } }; @@ -2405,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) { diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 037c8c9..265c9e8 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -438,6 +438,14 @@ properties = {/* type: "boolean", value: true, scope: "post" + }, + loadToolsAtStart: { + title: "Tool Loading", + description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: false, + scope: "post" } }; @@ -886,15 +894,16 @@ function prepareForToolCheck() { } function writeToolMeasureBlock(tool, preMeasure) { - // var writeFunction = measureTool ? writeBlock : writeOptionalBlock; - var writeFunction = writeBlock; + var writeBlockFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeWordsFunction = getProperty("measureToolsAtStart") ? writeWords() : writeWordsOptional; + var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { prepareForToolCheck(); } if (!staticProperties.useP9995) { // use Macro P9023 to measure tools var probingType = getHaasProbingTypeBIDC(tool.type, true); - writeFunction( + writeBlockFunction( gFormat.format(65), "P9023", "A" + probingType + ".", @@ -905,10 +914,10 @@ function writeToolMeasureBlock(tool, preMeasure) { ); } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes"); - setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter"); + setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes", !getProperty("measureToolsAtStart")); + setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter", !getProperty("measureToolsAtStart")); var probeType = getHaasProbingTypeBIDC(tool, false); - writeFunction( + writeBlockFunction( gFormat.format(65), "P9995", "A0.", @@ -921,13 +930,13 @@ function writeToolMeasureBlock(tool, preMeasure) { "I0.", comment ); // probe tool - writeWords("IF [[#" + (2000 + tool.number) + " GT " + + writeWordsFunction("IF [[#" + (2000 + tool.number) + " GT " + (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + (2000 + tool.number) + " LT " + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"); if (probeType == 3) { - writeWords("IF [[#" + (2400 + tool.number) + " GT " + + writeWordsFunction("IF [[#" + (2400 + tool.number) + " GT " + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + (2400 + tool.number) + " LT " + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); @@ -939,10 +948,19 @@ function writeToolMeasureBlock(tool, preMeasure) { // 6/28/21 | Gavin Williams | will1742 // 002 Improved Probing // sets specified macro number with value -function setMacro(macro, value, comment) { - writeWords("#" + macro + "=" + value, "(" + comment + ")"); +function setMacro(macro, value, comment, isOptional) { + if (isOptional) { + writeWordsOptional("#" + macro + "=" + value, "(" + comment + ")"); + } else { + writeWords("#" + macro + "=" + value, "(" + comment + ")"); + } +} + +function writeWordsOptional(text) { + writeWords("/ " + text); } + function defineMachineModel() { var useTCPC = getProperty("useTCPC"); switch (staticProperties.machineModel) { @@ -1316,8 +1334,12 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 // Probing now required. Using P9995. // optionally cycle through all tools - if (staticProperties.optionallyCycleToolsAtStart || getProperty("measureToolsAtStart")) { + // if (staticProperties.optionallyCycleToolsAtStart || getProperty("measureToolsAtStart")) { + if (true) { var tools = getToolTable(); + + var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + if (tools.getNumberOfTools() > 0) { writeln(""); /* @@ -1334,8 +1356,8 @@ function onOpen() { writeComment("Load and probe tools"); // Display general tool probe info - displayMedia("toolProbeReminder.jpg"); - writeBlock(mFormat.format(0)); + displayMedia("toolProbeReminder.jpg", !getProperty("measureToolsAtStart")); + writeFunction(mFormat.format(0)); let parsedTools = []; @@ -1422,15 +1444,12 @@ function onOpen() { comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); } comment += " - " + getToolTypeName(tool.type); + writeComment(tool.description); - if (getProperty("measureToolsAtStart")) { - writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg"); - writeBlock(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool - writeToolMeasureBlock(tool, true); - } else { - writeToolCycleBlock(tool); - } + writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("measureToolsAtStart")); + writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool + writeToolMeasureBlock(tool, true); } } @@ -2308,7 +2327,7 @@ function onSection() { // writeBlock(gFormat.format(53), "X" + macroFormat.format(100), yOutput.format(0)); writeBlock(gFormat.format(55), gFormat.format(0), xOutput.format(Stock_X_55)); writeBlock(gFormat.format(53), gFormat.format(0), yOutput.format(0)); - displayMedia("loadStock.jpg"); + displayMedia("loadStock.jpg", false); writeBlock(mFormat.format(0)); } @@ -2324,7 +2343,7 @@ function onSection() { writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool writeBlock(gFormat.format(55), gFormat.format(0), forceX.format(stockMidX), forceY.format(stockMidY)); - displayMedia("xyWCSCheck.jpg"); + displayMedia("xyWCSCheck.jpg", false); writeBlock(mFormat.format(0), formatComment("Open door")); /* displayMedia("Net Share/Media/checkPrompt.jpg"); @@ -2336,7 +2355,7 @@ function onSection() { writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); */ writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); - displayMedia("zWCSCheck.jpg"); + displayMedia("zWCSCheck.jpg", false); writeBlock(mFormat.format(0), formatComment("Open door")); writeBlock(mFormat.format(131), formatComment("End Multimedia")); @@ -2398,7 +2417,7 @@ function onSection() { } if (!isFirstSection()) { - displayMedia("checkPartTool.jpg"); + displayMedia("checkPartTool.jpg", false); writeBlock(mFormat.format(0)); writeBlock(mFormat.format(131)); } @@ -2775,7 +2794,7 @@ function onSection() { var toolDistance = initialPosition.z - stockTopZ; // Prompt user to check stock-tool distance - displayMedia("checkDistance" + toolDistance.toPrecision(2).toString().replace(".", "_") + ".jpg"); + displayMedia("checkDistance" + toolDistance.toPrecision(2).toString().replace(".", "_") + ".jpg", false); writeBlock(mFormat.format(0)); writeComment("OPEN DOOR"); //displayMedia("Net Share/Media/checkPrompt.jpg"); @@ -2815,8 +2834,12 @@ function onSection() { // Issue 001 Input and Validation // Displays a file: MP4, MOV, PNG, JPEG. 1920x1080 // Input: Absolute path to file -function displayMedia(file) { - writeBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); +function displayMedia(file, isOptional) { + if (isOptional) { + writeOptionalBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); + } else { + writeBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); + } } // Added 6/14/21 | Gavin Williams | will1742 @@ -2834,7 +2857,7 @@ function takeInput(prompt, options) { if (macroNumber > 549) macroNumber = 500; // init macro var to 0 - setMacro(macroNumber, 0, "Initialize macro variable"); + setMacro(macroNumber, 0, "Initialize macro variable", false); // disply prompt and save response writeBlock(mFormat.format(109), "P" + nFormat.format(macroNumber), formatComment(prompt)); @@ -4516,7 +4539,7 @@ function onClose() { continue; } writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - displayMedia("removeTool" + tool.number + ".jpg"); + displayMedia("removeTool" + tool.number + ".jpg", false); writeBlock(mFormat.format(0)); } } @@ -4524,14 +4547,14 @@ function onClose() { function gotoWithMessage(xLoc, yLoc, fileName) { writeBlock(gFormat.format(53), xOutput.format(xLoc), yOutput.format(yLoc)); - displayMedia(fileName); + displayMedia(fileName, false); writeBlock(mFormat.format(0)); } writeln(""); writeComment("CLEAN MACHINE"); gotoWithMessage(X_TRAVEL_LIMIT/2, 0, "airGunClean.jpg"); - displayMedia("floodCoolantOff.jpg") + displayMedia("floodCoolantOff.jpg", false) writeBlock(mFormat.format(0)); setCoolant(COOLANT_FLOOD); gotoWithMessage(0, Y_TRAVEL_LIMIT, "sprayLowerRight.jpg"); From 32648a3d2fcee7c699f6f7eaabc8683488b343fe Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 2 Sep 2021 15:32:21 -0400 Subject: [PATCH 02/17] Fixed null bug with optional tool measuring --- Haas_Mills_BIDC/Bechtel VF2.cps | 36 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 265c9e8..aea1f0f 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -894,8 +894,7 @@ function prepareForToolCheck() { } function writeToolMeasureBlock(tool, preMeasure) { - var writeBlockFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; - var writeWordsFunction = getProperty("measureToolsAtStart") ? writeWords() : writeWordsOptional; + var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { @@ -903,7 +902,7 @@ function writeToolMeasureBlock(tool, preMeasure) { } if (!staticProperties.useP9995) { // use Macro P9023 to measure tools var probingType = getHaasProbingTypeBIDC(tool.type, true); - writeBlockFunction( + writeFunction( gFormat.format(65), "P9023", "A" + probingType + ".", @@ -917,7 +916,7 @@ function writeToolMeasureBlock(tool, preMeasure) { setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes", !getProperty("measureToolsAtStart")); setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter", !getProperty("measureToolsAtStart")); var probeType = getHaasProbingTypeBIDC(tool, false); - writeBlockFunction( + writeFunction( gFormat.format(65), "P9995", "A0.", @@ -929,17 +928,20 @@ function writeToolMeasureBlock(tool, preMeasure) { "K" + xyzFormat.format(getHaasKFactorBIDC(tool)), "I0.", comment - ); // probe tool - writeWordsFunction("IF [[#" + (2000 + tool.number) + " GT " + + ); // probe tooling + var line1 = "IF [[#" + (2000 + tool.number) + " GT " + (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + (2000 + tool.number) + " LT " + - (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"); - + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); if (probeType == 3) { - writeWordsFunction("IF [[#" + (2400 + tool.number) + " GT " + + var line2 = "IF [[#" + (2400 + tool.number) + " GT " + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + (2400 + tool.number) + " LT " + - (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line2 : "/ " + line2); } } measureTool = false; @@ -949,15 +951,11 @@ function writeToolMeasureBlock(tool, preMeasure) { // 002 Improved Probing // sets specified macro number with value function setMacro(macro, value, comment, isOptional) { - if (isOptional) { - writeWordsOptional("#" + macro + "=" + value, "(" + comment + ")"); - } else { - writeWords("#" + macro + "=" + value, "(" + comment + ")"); - } -} - -function writeWordsOptional(text) { - writeWords("/ " + text); + if (isOptional) { + writeWords("/ #" + macro + "=" + value, "(" + comment + ")"); + } else { + writeWords("#" + macro + "=" + value, "(" + comment + ")"); + } } From 7224f387eb28e6559575ca6d5b826d1b334e8e1d Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 2 Sep 2021 16:41:25 -0400 Subject: [PATCH 03/17] added loadToolsAtStart as a property --- Haas_Mills_BIDC/Bechtel VF2.cps | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index aea1f0f..4ee81e3 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -444,7 +444,7 @@ properties = {/* description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: false, + value: true, scope: "post" } }; @@ -1336,7 +1336,7 @@ function onOpen() { if (true) { var tools = getToolTable(); - var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; if (tools.getNumberOfTools() > 0) { writeln(""); @@ -1354,7 +1354,7 @@ function onOpen() { writeComment("Load and probe tools"); // Display general tool probe info - displayMedia("toolProbeReminder.jpg", !getProperty("measureToolsAtStart")); + displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); writeFunction(mFormat.format(0)); let parsedTools = []; @@ -1445,7 +1445,7 @@ function onOpen() { writeComment(tool.description); writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("measureToolsAtStart")); + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool writeToolMeasureBlock(tool, true); } From bb22cf4faea20e6f0ed5030c93eb788be2488cd4 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 2 Sep 2021 16:52:42 -0400 Subject: [PATCH 04/17] fixed bug with loadTools and measureTools are both 'false' --- Haas_Lathes_BIDC/Bechtel ST-20.cps | 32 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/Haas_Lathes_BIDC/Bechtel ST-20.cps b/Haas_Lathes_BIDC/Bechtel ST-20.cps index 3287952..92bd7cb 100644 --- a/Haas_Lathes_BIDC/Bechtel ST-20.cps +++ b/Haas_Lathes_BIDC/Bechtel ST-20.cps @@ -356,7 +356,7 @@ properties = { description: "Tool loading and probing. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: true, + value: false, scope: "post" }, loadToolsAtStart: { @@ -1363,22 +1363,20 @@ function onOpen() { writeln(""); } - if (getProperty("loadToolsAtStart") || getProperty("measureToolsAtStart")) { - writeln(""); - // will1742 | Gavin Williams | 8/10/21 - // Auto probe tools - var tools = getToolTable(); - if (tools.getNumberOfTools() > 0) { - for (var i = 0; i < tools.getNumberOfTools(); ++i) { - var tool = tools.getTool(i); - var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset; - var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100); - var writeLoad = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; - writeLoad("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6)); - writeLoad(mFormat.format(0)); - writeComment("LOAD T" + tool.number + ": " + tool.description); - writeToolMeasureBlockBIDC(tool); - } + writeln(""); + // will1742 | Gavin Williams | 8/10/21 + // Auto probe tools + var tools = getToolTable(); + if (tools.getNumberOfTools() > 0) { + for (var i = 0; i < tools.getNumberOfTools(); ++i) { + var tool = tools.getTool(i); + var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset; + var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100); + var writeLoad = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + writeLoad("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6)); + writeLoad(mFormat.format(0)); + writeComment("LOAD T" + tool.number + ": " + tool.description); + writeToolMeasureBlockBIDC(tool); } } From 05d50c92f6cdf97848de1b350c1a8a009c371e74 Mon Sep 17 00:00:00 2001 From: pan261 Date: Mon, 6 Sep 2021 14:46:19 -0400 Subject: [PATCH 05/17] propagated VF2 changes to VF4 and DT --- Haas_Mills_BIDC/Bechtel DT.cps | 101 ++++++++++++++++++++------------ Haas_Mills_BIDC/Bechtel VF4.cps | 93 +++++++++++++++++++---------- 2 files changed, 126 insertions(+), 68 deletions(-) diff --git a/Haas_Mills_BIDC/Bechtel DT.cps b/Haas_Mills_BIDC/Bechtel DT.cps index d5352a4..184e038 100644 --- a/Haas_Mills_BIDC/Bechtel DT.cps +++ b/Haas_Mills_BIDC/Bechtel DT.cps @@ -436,7 +436,15 @@ 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" + }, + loadToolsAtStart: { + title: "Tool Loading", + description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, scope: "post" } }; @@ -886,8 +894,8 @@ function prepareForToolCheck() { } function writeToolMeasureBlock(tool, preMeasure) { - // var writeFunction = measureTool ? writeBlock : writeOptionalBlock; - var writeFunction = writeBlock; + var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + // var writeFunction = writeBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { prepareForToolCheck(); @@ -905,8 +913,8 @@ function writeToolMeasureBlock(tool, preMeasure) { ); } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes"); - setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter"); + setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes", !getProperty("measureToolsAtStart")); + setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter", !getProperty("measureToolsAtStart")); var probeType = getHaasProbingTypeBIDC(tool, false); writeFunction( gFormat.format(65), @@ -921,16 +929,20 @@ function writeToolMeasureBlock(tool, preMeasure) { "I0.", comment ); // probe tool - writeWords("IF [[#" + (2000 + tool.number) + " GT " + + line1 = "IF [[#" + (2000 + tool.number) + " GT " + (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + (2000 + tool.number) + " LT " + - (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"); + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); if (probeType == 3) { - writeWords("IF [[#" + (2400 + tool.number) + " GT " + + line2 = "IF [[#" + (2400 + tool.number) + " GT " + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + (2400 + tool.number) + " LT " + - (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line2 : "/ " + line2); } } measureTool = false; @@ -939,8 +951,12 @@ function writeToolMeasureBlock(tool, preMeasure) { // 6/28/21 | Gavin Williams | will1742 // 002 Improved Probing // sets specified macro number with value -function setMacro(macro, value, comment) { - writeWords("#" + macro + "=" + value, "(" + comment + ")"); +function setMacro(macro, value, comment, isOptional) { + if (isOptional) { + writeWords("/ #" + macro + "=" + value, "(" + comment + ")"); + } else { + writeWords("#" + macro + "=" + value, "(" + comment + ")"); + } } function defineMachineModel() { @@ -1316,8 +1332,11 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 // Probing now required. Using P9995. // optionally cycle through all tools - if (staticProperties.optionallyCycleToolsAtStart || getProperty("measureToolsAtStart")) { + if (true) { var tools = getToolTable(); + + var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + if (tools.getNumberOfTools() > 0) { writeln(""); /* @@ -1333,11 +1352,13 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 writeComment("Load and probe tools"); - displayMedia("toolProbeReminder.jpg"); - writeBlock(mFormat.format(0)); + // Display general tool probe info + displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0)); let parsedTools = []; + // Maybe should be anonymous function?? function defaultFill() { parsedTools = [] for (var i = 0; i < tools.getNumberOfTools(); i++){ @@ -1345,19 +1366,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 +1393,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 { @@ -1413,14 +1442,10 @@ function onOpen() { } comment += " - " + getToolTypeName(tool.type); writeComment(tool.description); - if (getProperty("measureToolsAtStart")) { - writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg"); - writeBlock(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool - writeToolMeasureBlock(tool, true); - } else { - writeToolCycleBlock(tool); - } + writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool + writeToolMeasureBlock(tool, true); } } @@ -2296,7 +2321,7 @@ function onSection() { // writeBlock(gFormat.format(53), "X" + macroFormat.format(100), yOutput.format(0)); writeBlock(gFormat.format(55), gFormat.format(0), xOutput.format(Stock_X_55)); writeBlock(gFormat.format(53), gFormat.format(0), yOutput.format(0)); - displayMedia("loadStock.jpg"); + displayMedia("loadStock.jpg", false); writeBlock(mFormat.format(0)); } @@ -2312,7 +2337,7 @@ function onSection() { writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool writeBlock(gFormat.format(55), gFormat.format(0), forceX.format(stockMidX), forceY.format(stockMidY)); - displayMedia("xyWCSCheck.jpg"); + displayMedia("xyWCSCheck.jpg", false); writeBlock(mFormat.format(0), formatComment("Open door")); /* displayMedia("Net Share/Media/checkPrompt.jpg"); @@ -2324,7 +2349,7 @@ function onSection() { writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); */ writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); - displayMedia("zWCSCheck.jpg"); + displayMedia("zWCSCheck.jpg", false); writeBlock(mFormat.format(0), formatComment("Open door")); writeBlock(mFormat.format(131), formatComment("End Multimedia")); @@ -2386,7 +2411,7 @@ function onSection() { } if (!isFirstSection()) { - displayMedia("checkPartTool.jpg"); + displayMedia("checkPartTool.jpg", false); writeBlock(mFormat.format(0)); writeBlock(mFormat.format(131)); } @@ -2763,7 +2788,7 @@ function onSection() { var toolDistance = initialPosition.z - stockTopZ; // Prompt user to check stock-tool distance - displayMedia("checkDistance" + toolDistance.toPrecision(2).toString().replace(".", "_") + ".jpg"); + displayMedia("checkDistance" + toolDistance.toPrecision(2).toString().replace(".", "_") + ".jpg", false); writeBlock(mFormat.format(0)); writeComment("OPEN DOOR"); //displayMedia("Net Share/Media/checkPrompt.jpg"); @@ -2803,8 +2828,12 @@ function onSection() { // Issue 001 Input and Validation // Displays a file: MP4, MOV, PNG, JPEG. 1920x1080 // Input: Absolute path to file -function displayMedia(file) { - writeBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); +function displayMedia(file, isOptional) { + if (isOptional) { + writeOptionalBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); + } else { + writeBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); + } } // Added 6/14/21 | Gavin Williams | will1742 @@ -2822,7 +2851,7 @@ function takeInput(prompt, options) { if (macroNumber > 549) macroNumber = 500; // init macro var to 0 - setMacro(macroNumber, 0, "Initialize macro variable"); + setMacro(macroNumber, 0, "Initialize macro variable", false); // disply prompt and save response writeBlock(mFormat.format(109), "P" + nFormat.format(macroNumber), formatComment(prompt)); @@ -4504,7 +4533,7 @@ function onClose() { continue; } writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - displayMedia("removeTool" + tool.number + ".jpg"); + displayMedia("removeTool" + tool.number + ".jpg", false); writeBlock(mFormat.format(0)); } } @@ -4512,14 +4541,14 @@ function onClose() { function gotoWithMessage(xLoc, yLoc, fileName) { writeBlock(gFormat.format(53), xOutput.format(xLoc), yOutput.format(yLoc)); - displayMedia(fileName); + displayMedia(fileName, false); writeBlock(mFormat.format(0)); } writeln(""); writeComment("CLEAN MACHINE"); gotoWithMessage(X_TRAVEL_LIMIT/2, 0, "airGunClean.jpg"); - displayMedia("floodCoolantOff.jpg") + displayMedia("floodCoolantOff.jpg", false) writeBlock(mFormat.format(0)); setCoolant(COOLANT_FLOOD); gotoWithMessage(0, Y_TRAVEL_LIMIT, "sprayLowerRight.jpg"); diff --git a/Haas_Mills_BIDC/Bechtel VF4.cps b/Haas_Mills_BIDC/Bechtel VF4.cps index 29a6290..c37b6a3 100644 --- a/Haas_Mills_BIDC/Bechtel VF4.cps +++ b/Haas_Mills_BIDC/Bechtel VF4.cps @@ -438,6 +438,14 @@ properties = {/* type: "boolean", value: true, scope: "post" + }, + loadToolsAtStart: { + title: "Tool Loading", + description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" } }; @@ -886,8 +894,8 @@ function prepareForToolCheck() { } function writeToolMeasureBlock(tool, preMeasure) { - // var writeFunction = measureTool ? writeBlock : writeOptionalBlock; - var writeFunction = writeBlock; + var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + // var writeFunction = writeBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { prepareForToolCheck(); @@ -905,8 +913,8 @@ function writeToolMeasureBlock(tool, preMeasure) { ); } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes"); - setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter"); + setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes", !getProperty("measureToolsAtStart")); + setMacro(2400 + tool.number, xyzFormat.format(tool.diameter), "Tool Diameter", !getProperty("measureToolsAtStart")); var probeType = getHaasProbingTypeBIDC(tool, false); writeFunction( gFormat.format(65), @@ -921,16 +929,20 @@ function writeToolMeasureBlock(tool, preMeasure) { "I0.", comment ); // probe tool - writeWords("IF [[#" + (2000 + tool.number) + " GT " + + line1 = "IF [[#" + (2000 + tool.number) + " GT " + (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + (2000 + tool.number) + " LT " + - (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"); + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); if (probeType == 3) { - writeWords("IF [[#" + (2400 + tool.number) + " GT " + + line2 = "IF [[#" + (2400 + tool.number) + " GT " + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + (2400 + tool.number) + " LT " + - (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line2 : "/ " + line2); } } measureTool = false; @@ -939,8 +951,12 @@ function writeToolMeasureBlock(tool, preMeasure) { // 6/28/21 | Gavin Williams | will1742 // 002 Improved Probing // sets specified macro number with value -function setMacro(macro, value, comment) { - writeWords("#" + macro + "=" + value, "(" + comment + ")"); +function setMacro(macro, value, comment, isOptional) { + if (isOptional) { + writeWords("/ #" + macro + "=" + value, "(" + comment + ")"); + } else { + writeWords("#" + macro + "=" + value, "(" + comment + ")"); + } } function defineMachineModel() { @@ -1316,8 +1332,11 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 // Probing now required. Using P9995. // optionally cycle through all tools - if (staticProperties.optionallyCycleToolsAtStart || getProperty("measureToolsAtStart")) { + if (true) { var tools = getToolTable(); + + var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + if (tools.getNumberOfTools() > 0) { writeln(""); /* @@ -1333,11 +1352,13 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 writeComment("Load and probe tools"); - displayMedia("toolProbeReminder.jpg"); - writeBlock(mFormat.format(0)); + // Display general tool probe info + displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0)); let parsedTools = []; + // Maybe should be anonymous function?? function defaultFill() { parsedTools = [] for (var i = 0; i < tools.getNumberOfTools(); i++){ @@ -1345,19 +1366,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 +1393,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 { @@ -1413,14 +1442,10 @@ function onOpen() { } comment += " - " + getToolTypeName(tool.type); writeComment(tool.description); - if (getProperty("measureToolsAtStart")) { - writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg"); - writeBlock(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool - writeToolMeasureBlock(tool, true); - } else { - writeToolCycleBlock(tool); - } + writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool + writeToolMeasureBlock(tool, true); } } @@ -2410,7 +2435,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) { @@ -2808,8 +2833,12 @@ function onSection() { // Issue 001 Input and Validation // Displays a file: MP4, MOV, PNG, JPEG. 1920x1080 // Input: Absolute path to file -function displayMedia(file) { - writeBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); +function displayMedia(file, isOptional) { + if (isOptional) { + writeOptionalBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); + } else { + writeBlock(mFormat.format(130), formatComment("Net Share/Media/" + file)); + } } // Added 6/14/21 | Gavin Williams | will1742 @@ -2827,7 +2856,7 @@ function takeInput(prompt, options) { if (macroNumber > 549) macroNumber = 500; // init macro var to 0 - setMacro(macroNumber, 0, "Initialize macro variable"); + setMacro(macroNumber, 0, "Initialize macro variable", false); // disply prompt and save response writeBlock(mFormat.format(109), "P" + nFormat.format(macroNumber), formatComment(prompt)); @@ -4509,7 +4538,7 @@ function onClose() { continue; } writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - displayMedia("removeTool" + tool.number + ".jpg"); + displayMedia("removeTool" + tool.number + ".jpg", false); writeBlock(mFormat.format(0)); } } @@ -4517,14 +4546,14 @@ function onClose() { function gotoWithMessage(xLoc, yLoc, fileName) { writeBlock(gFormat.format(53), xOutput.format(xLoc), yOutput.format(yLoc)); - displayMedia(fileName); + displayMedia(fileName, false); writeBlock(mFormat.format(0)); } writeln(""); writeComment("CLEAN MACHINE"); gotoWithMessage(X_TRAVEL_LIMIT/2, 0, "airGunClean.jpg"); - displayMedia("floodCoolantOff.jpg") + displayMedia("floodCoolantOff.jpg", false) writeBlock(mFormat.format(0)); setCoolant(COOLANT_FLOOD); gotoWithMessage(0, Y_TRAVEL_LIMIT, "sprayLowerRight.jpg"); From c750ece555a656d6a7e949becfcfe88f4fcf21de Mon Sep 17 00:00:00 2001 From: pan261 Date: Mon, 6 Sep 2021 15:02:22 -0400 Subject: [PATCH 06/17] Updated ST-20Y Fixed ST-20Y bug, same issue as ST-20 (when both load and measure tool properties are false, no blocks would print) --- Haas_Lathes_BIDC/Bechtel ST-20Y.cps | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Haas_Lathes_BIDC/Bechtel ST-20Y.cps b/Haas_Lathes_BIDC/Bechtel ST-20Y.cps index 351da16..342db24 100644 --- a/Haas_Lathes_BIDC/Bechtel ST-20Y.cps +++ b/Haas_Lathes_BIDC/Bechtel ST-20Y.cps @@ -356,7 +356,7 @@ properties = { description: "Tool loading and probing. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: true, + value: false, scope: "post" }, loadToolsAtStart: { @@ -364,7 +364,7 @@ properties = { description: "Tool loading only. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: true, + value: false, scope: "post" } }; @@ -1418,25 +1418,25 @@ function onOpen() { writeln(""); } - if (getProperty("loadToolsAtStart") || getProperty("measureToolsAtStart")) { - writeln(""); - // will1742 | Gavin Williams | 8/10/21 - // Auto probe tools - var tools = getToolTable(); - if (tools.getNumberOfTools() > 0) { - for (var i = 0; i < tools.getNumberOfTools(); ++i) { - var tool = tools.getTool(i); - var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset; - var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100); - var writeLoad = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; - writeLoad("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6)); - writeLoad(mFormat.format(0)); - writeComment("LOAD T" + tool.number + ": " + tool.description); - writeToolMeasureBlockBIDC(tool); - } + + writeln(""); + // will1742 | Gavin Williams | 8/10/21 + // Auto probe tools + var tools = getToolTable(); + if (tools.getNumberOfTools() > 0) { + for (var i = 0; i < tools.getNumberOfTools(); ++i) { + var tool = tools.getTool(i); + var compensationOffset = tool.isTurningTool() ? tool.compensationOffset : tool.lengthOffset; + var toolPosition = toolFormat.format(tool.number * 100 + compensationOffset % 100); + var writeLoad = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + writeLoad("T" + toolFormat.format((tool.number - 3) >= 1 ? tool.number - 3 : tool.number + 9), mFormat.format(6)); + writeLoad(mFormat.format(0)); + writeComment("LOAD T" + tool.number + ": " + tool.description); + writeToolMeasureBlockBIDC(tool); } } + if (false) { // check for duplicate tool number for (var i = 0; i < getNumberOfSections(); ++i) { From 9013f613bbd67674ae39f0bd55eaa0b312bd438c Mon Sep 17 00:00:00 2001 From: "Williams, Gavin J" Date: Mon, 6 Sep 2021 16:13:59 -0400 Subject: [PATCH 07/17] Measure/load independently optional --- Haas_Mills_BIDC/Bechtel DT.cps | 220 +++++++++++++++--------------- Haas_Mills_BIDC/Bechtel VF2.cps | 202 ++++++++++++++-------------- Haas_Mills_BIDC/Bechtel VF4.cps | 229 ++++++++++++++++---------------- 3 files changed, 320 insertions(+), 331 deletions(-) diff --git a/Haas_Mills_BIDC/Bechtel DT.cps b/Haas_Mills_BIDC/Bechtel DT.cps index 184e038..2a04feb 100644 --- a/Haas_Mills_BIDC/Bechtel DT.cps +++ b/Haas_Mills_BIDC/Bechtel DT.cps @@ -928,17 +928,16 @@ function writeToolMeasureBlock(tool, preMeasure) { "K" + xyzFormat.format(getHaasKFactorBIDC(tool)), "I0.", comment - ); // probe tool - line1 = "IF [[#" + (2000 + tool.number) + " GT " + - (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + - (2000 + tool.number) + " LT " + - (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; - - writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); - - if (probeType == 3) { - line2 = "IF [[#" + (2400 + tool.number) + " GT " + - (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + + ); // probe tooling + var line1 = "IF [[#" + (2000 + tool.number) + " GT " + + (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + + (2000 + tool.number) + " LT " + + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); + if (probeType == 3) { + var line2 = "IF [[#" + (2400 + tool.number) + " GT " + + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + (2400 + tool.number) + " LT " + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"; @@ -1332,128 +1331,127 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 // Probing now required. Using P9995. // optionally cycle through all tools - if (true) { - var tools = getToolTable(); + var tools = getToolTable(); - var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; - if (tools.getNumberOfTools() > 0) { - writeln(""); - /* - writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator - writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); - writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); - if (getProperty("optionallyMeasureToolsAtStart")) { - writeComment(localize("and to automatically measure it")); - } - writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); - */ + if (tools.getNumberOfTools() > 0) { + writeln(""); + /* + writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator + writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); + writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); + if (getProperty("optionallyMeasureToolsAtStart")) { + writeComment(localize("and to automatically measure it")); + } + writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); + */ - // 6/21/21 | Gavin Williams | will1742 - writeComment("Load and probe tools"); + // 6/21/21 | Gavin Williams | will1742 + writeComment("Load and probe tools"); - // Display general tool probe info - displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); - writeFunction(mFormat.format(0)); + // Display general tool probe info + displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0)); - let parsedTools = []; + let parsedTools = []; - // Maybe should be anonymous function?? - function defaultFill() { - parsedTools = [] - for (var i = 0; i < tools.getNumberOfTools(); i++){ - parsedTools[i] = tools.getTool(i).number; - } + // Maybe should be anonymous function?? + function defaultFill() { + parsedTools = [] + for (var i = 0; i < tools.getNumberOfTools(); i++){ + parsedTools[i] = tools.getTool(i).number; } + } - // 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); - } + // 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 (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]))) { + // 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; } - // push single num - parsedTools.push(parseInt(toolNumArray[i])); - } - } else { - defaultFill(); - } - - for (var i = 0; i < tools.getNumberOfTools(); i++) { - var tool = tools.getTool(i); - if (tool.bodyLength + tool.holderLength > MAX_TOOL_LENGTH) { - throw "Error: T" + tool.number + " length greater than machine max" + for(var j = numRange[0]; j <= numRange[1]; j++){ + parsedTools.push(parseInt(j)); + } + continue; } - - if (tool.diameter > MAX_TOOL_DIAM) { - throw "Error : T" + tool.number + " diameter greater than machine max" + // check if valid num + if (invalidToolNum(parseInt(toolNumArray[i]))) { + defaultFill(); + break; } + // push single num + parsedTools.push(parseInt(toolNumArray[i])); + } + } else { + defaultFill(); + } - if (parsedTools.indexOf(tool.number) <= -1) { - continue; - } + for (var i = 0; i < tools.getNumberOfTools(); i++) { + var tool = tools.getTool(i); + if (tool.bodyLength + tool.holderLength > MAX_TOOL_LENGTH) { + throw "Error: T" + tool.number + " length greater than machine max" + } - if (getProperty("measureToolsAtStart") && (tool.type == TOOL_PROBE)) { - continue; - } + if (tool.diameter > MAX_TOOL_DIAM) { + throw "Error : T" + tool.number + " diameter greater than machine max" + } - // 07/16/21 | will1742 | Gavin Williams - // Verify tool numbers - if (tool.number == 20 && tool.type != TOOL_PROBE) { - throw "Error: T20 is reserved for Probe"; - } + if (parsedTools.indexOf(tool.number) <= -1) { + continue; + } - if (tool.number == 19) { - throw "Error: T19 is reserved for WCS verification tool"; - } + if (getProperty("measureToolsAtStart") && (tool.type == TOOL_PROBE)) { + continue; + } - writeln(""); - var comment = "T" + toolFormat.format(tool.number) + " " + - "D=" + xyzFormat.format(tool.diameter) + " " + - localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); - if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { - comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); - } - comment += " - " + getToolTypeName(tool.type); - writeComment(tool.description); - writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); - writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool - writeToolMeasureBlock(tool, true); + // 07/16/21 | will1742 | Gavin Williams + // Verify tool numbers + if (tool.number == 20 && tool.type != TOOL_PROBE) { + throw "Error: T20 is reserved for Probe"; } - } - writeln(""); - writeComment("SETUP FOR OPERATION"); - writeBlock(mFormat.format(131)); + if (tool.number == 19) { + throw "Error: T19 is reserved for WCS verification tool"; + } + + writeln(""); + var comment = "T" + toolFormat.format(tool.number) + " " + + "D=" + xyzFormat.format(tool.diameter) + " " + + localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); + if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { + comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); + } + comment += " - " + getToolTypeName(tool.type); + + writeComment(tool.description); + writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool + writeToolMeasureBlock(tool, true); + } } + writeln(""); + writeComment("SETUP FOR OPERATION"); + writeFunction(mFormat.format(131)); + if (staticProperties.useDWO) { var failed = false; var dynamicWCSs = {}; @@ -2430,7 +2428,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) { diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 4ee81e3..108f24e 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -958,7 +958,6 @@ function setMacro(macro, value, comment, isOptional) { } } - function defineMachineModel() { var useTCPC = getProperty("useTCPC"); switch (staticProperties.machineModel) { @@ -1332,132 +1331,127 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 // Probing now required. Using P9995. // optionally cycle through all tools - // if (staticProperties.optionallyCycleToolsAtStart || getProperty("measureToolsAtStart")) { - if (true) { - var tools = getToolTable(); + var tools = getToolTable(); - var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; - if (tools.getNumberOfTools() > 0) { - writeln(""); - /* - writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator - writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); - writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); - if (getProperty("optionallyMeasureToolsAtStart")) { - writeComment(localize("and to automatically measure it")); - } - writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); - */ + if (tools.getNumberOfTools() > 0) { + writeln(""); + /* + writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator + writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); + writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); + if (getProperty("optionallyMeasureToolsAtStart")) { + writeComment(localize("and to automatically measure it")); + } + writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); + */ - // 6/21/21 | Gavin Williams | will1742 - writeComment("Load and probe tools"); + // 6/21/21 | Gavin Williams | will1742 + writeComment("Load and probe tools"); - // Display general tool probe info - displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); - writeFunction(mFormat.format(0)); + // Display general tool probe info + displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0)); - let parsedTools = []; + let parsedTools = []; - // Maybe should be anonymous function?? - function defaultFill() { - parsedTools = [] - for (var i = 0; i < tools.getNumberOfTools(); i++){ - parsedTools[i] = tools.getTool(i).number; - } + // Maybe should be anonymous function?? + function defaultFill() { + parsedTools = [] + for (var i = 0; i < tools.getNumberOfTools(); i++){ + parsedTools[i] = tools.getTool(i).number; } + } - // 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); - } + // 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 (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]))) { + // 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; } - // push single num - parsedTools.push(parseInt(toolNumArray[i])); - } - } else { - defaultFill(); - } - - for (var i = 0; i < tools.getNumberOfTools(); i++) { - var tool = tools.getTool(i); - if (tool.bodyLength + tool.holderLength > MAX_TOOL_LENGTH) { - throw "Error: T" + tool.number + " length greater than machine max" + for(var j = numRange[0]; j <= numRange[1]; j++){ + parsedTools.push(parseInt(j)); + } + continue; } - - if (tool.diameter > MAX_TOOL_DIAM) { - throw "Error : T" + tool.number + " diameter greater than machine max" + // check if valid num + if (invalidToolNum(parseInt(toolNumArray[i]))) { + defaultFill(); + break; } + // push single num + parsedTools.push(parseInt(toolNumArray[i])); + } + } else { + defaultFill(); + } - if (parsedTools.indexOf(tool.number) <= -1) { - continue; - } + for (var i = 0; i < tools.getNumberOfTools(); i++) { + var tool = tools.getTool(i); + if (tool.bodyLength + tool.holderLength > MAX_TOOL_LENGTH) { + throw "Error: T" + tool.number + " length greater than machine max" + } - if (getProperty("measureToolsAtStart") && (tool.type == TOOL_PROBE)) { - continue; - } + if (tool.diameter > MAX_TOOL_DIAM) { + throw "Error : T" + tool.number + " diameter greater than machine max" + } - // 07/16/21 | will1742 | Gavin Williams - // Verify tool numbers - if (tool.number == 20 && tool.type != TOOL_PROBE) { - throw "Error: T20 is reserved for Probe"; - } + if (parsedTools.indexOf(tool.number) <= -1) { + continue; + } - if (tool.number == 19) { - throw "Error: T19 is reserved for WCS verification tool"; - } + if (getProperty("measureToolsAtStart") && (tool.type == TOOL_PROBE)) { + continue; + } - writeln(""); - var comment = "T" + toolFormat.format(tool.number) + " " + - "D=" + xyzFormat.format(tool.diameter) + " " + - localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); - if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { - comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); - } - comment += " - " + getToolTypeName(tool.type); + // 07/16/21 | will1742 | Gavin Williams + // Verify tool numbers + if (tool.number == 20 && tool.type != TOOL_PROBE) { + throw "Error: T20 is reserved for Probe"; + } - writeComment(tool.description); - writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); - writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool - writeToolMeasureBlock(tool, true); + if (tool.number == 19) { + throw "Error: T19 is reserved for WCS verification tool"; } - } - writeln(""); - writeComment("SETUP FOR OPERATION"); - writeBlock(mFormat.format(131)); - } else { - writeComment("SETUP FOR OPERATION"); + writeln(""); + var comment = "T" + toolFormat.format(tool.number) + " " + + "D=" + xyzFormat.format(tool.diameter) + " " + + localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); + if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { + comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); + } + comment += " - " + getToolTypeName(tool.type); + + writeComment(tool.description); + writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool + writeToolMeasureBlock(tool, true); + } } + writeln(""); + writeComment("SETUP FOR OPERATION"); + writeFunction(mFormat.format(131)); + if (staticProperties.useDWO) { var failed = false; var dynamicWCSs = {}; @@ -2434,7 +2428,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) { diff --git a/Haas_Mills_BIDC/Bechtel VF4.cps b/Haas_Mills_BIDC/Bechtel VF4.cps index c37b6a3..882c1c2 100644 --- a/Haas_Mills_BIDC/Bechtel VF4.cps +++ b/Haas_Mills_BIDC/Bechtel VF4.cps @@ -928,16 +928,15 @@ function writeToolMeasureBlock(tool, preMeasure) { "K" + xyzFormat.format(getHaasKFactorBIDC(tool)), "I0.", comment - ); // probe tool - line1 = "IF [[#" + (2000 + tool.number) + " GT " + - (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + - (2000 + tool.number) + " LT " + - (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; - - writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); - - if (probeType == 3) { - line2 = "IF [[#" + (2400 + tool.number) + " GT " + + ); // probe tooling + var line1 = "IF [[#" + (2000 + tool.number) + " GT " + + (tool.bodyLength + tool.holderLength + LENGTH_TOLERANCE).toFixed(2) + "] OR [#" + + (2000 + tool.number) + " LT " + + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"; + + writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); + if (probeType == 3) { + var line2 = "IF [[#" + (2400 + tool.number) + " GT " + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + (2400 + tool.number) + " LT " + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"; @@ -1332,128 +1331,126 @@ function onOpen() { // 6/21/21 | Gavin Williams | will1742 // Probing now required. Using P9995. // optionally cycle through all tools - if (true) { - var tools = getToolTable(); + var tools = getToolTable(); - var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeFunction = getProperty("loadToolsAtStart") ? writeBlock : writeOptionalBlock; - if (tools.getNumberOfTools() > 0) { - writeln(""); - /* - writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator - writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); - writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); - if (getProperty("optionallyMeasureToolsAtStart")) { - writeComment(localize("and to automatically measure it")); - } - writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); - */ + if (tools.getNumberOfTools() > 0) { + writeln(""); + /* + writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator + writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); + writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); + if (getProperty("optionallyMeasureToolsAtStart")) { + writeComment(localize("and to automatically measure it")); + } + writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); + */ - // 6/21/21 | Gavin Williams | will1742 - writeComment("Load and probe tools"); + // 6/21/21 | Gavin Williams | will1742 + writeComment("Load and probe tools"); - // Display general tool probe info - displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); - writeFunction(mFormat.format(0)); + // Display general tool probe info + displayMedia("toolProbeReminder.jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0)); - let parsedTools = []; + let parsedTools = []; - // Maybe should be anonymous function?? - function defaultFill() { - parsedTools = [] - for (var i = 0; i < tools.getNumberOfTools(); i++){ - parsedTools[i] = tools.getTool(i).number; - } + // Maybe should be anonymous function?? + function defaultFill() { + parsedTools = [] + for (var i = 0; i < tools.getNumberOfTools(); i++){ + parsedTools[i] = tools.getTool(i).number; } + } - // 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 (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]))) { + // 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 (invalidToolNum(parseInt(numRange[0])) || invalidToolNum(parseInt(numRange[1]))) { 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 (tool.bodyLength + tool.holderLength > MAX_TOOL_LENGTH) { - throw "Error: T" + tool.number + " length greater than machine max" + for(var j = numRange[0]; j <= numRange[1]; j++){ + parsedTools.push(parseInt(j)); + } + continue; } - - if (tool.diameter > MAX_TOOL_DIAM) { - throw "Error : T" + tool.number + " diameter greater than machine max" + // check if valid num + if (invalidToolNum(parseInt(toolNumArray[i]))) { + defaultFill(); + break; } + // push single num + parsedTools.push(parseInt(toolNumArray[i])); + } + } else { + defaultFill(); + } - if (parsedTools.indexOf(tool.number) <= -1) { - continue; - } + for (var i = 0; i < tools.getNumberOfTools(); i++) { + var tool = tools.getTool(i); + if (tool.bodyLength + tool.holderLength > MAX_TOOL_LENGTH) { + throw "Error: T" + tool.number + " length greater than machine max" + } - if (getProperty("measureToolsAtStart") && (tool.type == TOOL_PROBE)) { - continue; - } + if (tool.diameter > MAX_TOOL_DIAM) { + throw "Error : T" + tool.number + " diameter greater than machine max" + } - // 07/16/21 | will1742 | Gavin Williams - // Verify tool numbers - if (tool.number == 20 && tool.type != TOOL_PROBE) { - throw "Error: T20 is reserved for Probe"; - } + if (parsedTools.indexOf(tool.number) <= -1) { + continue; + } - if (tool.number == 19) { - throw "Error: T19 is reserved for WCS verification tool"; - } + if (getProperty("measureToolsAtStart") && (tool.type == TOOL_PROBE)) { + continue; + } - writeln(""); - var comment = "T" + toolFormat.format(tool.number) + " " + - "D=" + xyzFormat.format(tool.diameter) + " " + - localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); - if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { - comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); - } - comment += " - " + getToolTypeName(tool.type); - writeComment(tool.description); - writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); - writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool - writeToolMeasureBlock(tool, true); + // 07/16/21 | will1742 | Gavin Williams + // Verify tool numbers + if (tool.number == 20 && tool.type != TOOL_PROBE) { + throw "Error: T20 is reserved for Probe"; + } + + if (tool.number == 19) { + throw "Error: T19 is reserved for WCS verification tool"; + } + + writeln(""); + var comment = "T" + toolFormat.format(tool.number) + " " + + "D=" + xyzFormat.format(tool.diameter) + " " + + localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); + if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { + comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); } + comment += " - " + getToolTypeName(tool.type); + writeComment(tool.description); + writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool + displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); + writeFunction(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool + writeToolMeasureBlock(tool, true); } - - writeln(""); - writeComment("SETUP FOR OPERATION"); - writeBlock(mFormat.format(131)); } - + + writeln(""); + writeComment("SETUP FOR OPERATION"); + writeFunction(mFormat.format(131)); + if (staticProperties.useDWO) { var failed = false; var dynamicWCSs = {}; @@ -2342,7 +2339,7 @@ function onSection() { } else if (getProperty("hasAAxis") != "false") { writeBlock(gFormat.format(0), aOutput.format(0)); } - displayMedia("xyWCSCheck.jpg"); + displayMedia("xyWCSCheck.jpg", false); writeBlock(mFormat.format(0), formatComment("Open door")); /* displayMedia("Net Share/Media/checkPrompt.jpg"); @@ -2354,7 +2351,7 @@ function onSection() { writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); */ writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); - displayMedia("zWCSCheck.jpg"); + displayMedia("zWCSCheck.jpg", false); writeBlock(mFormat.format(0), formatComment("Open door")); writeBlock(mFormat.format(131), formatComment("End Multimedia")); @@ -2416,7 +2413,7 @@ function onSection() { } if (!isFirstSection()) { - displayMedia("checkPartTool.jpg"); + displayMedia("checkPartTool.jpg", false); writeBlock(mFormat.format(0)); writeBlock(mFormat.format(131)); } @@ -2435,7 +2432,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) { @@ -2793,7 +2790,7 @@ function onSection() { var toolDistance = initialPosition.z - stockTopZ; // Prompt user to check stock-tool distance - displayMedia("checkDistance" + toolDistance.toPrecision(2).toString().replace(".", "_") + ".jpg"); + displayMedia("checkDistance" + toolDistance.toPrecision(2).toString().replace(".", "_") + ".jpg", false); writeBlock(mFormat.format(0)); writeComment("OPEN DOOR"); //displayMedia("Net Share/Media/checkPrompt.jpg"); From 56bcf3d12cc9f7334df34e20d120e0a96469d3d2 Mon Sep 17 00:00:00 2001 From: pan261 Date: Mon, 6 Sep 2021 17:29:26 -0400 Subject: [PATCH 08/17] Optional tool measure blocks for SR --- Haas_Gantry_BIDC/Bechtel SR.cps | 122 +++++++++++++++++++------------- 1 file changed, 71 insertions(+), 51 deletions(-) diff --git a/Haas_Gantry_BIDC/Bechtel SR.cps b/Haas_Gantry_BIDC/Bechtel SR.cps index 1add6d0..f92d238 100644 --- a/Haas_Gantry_BIDC/Bechtel SR.cps +++ b/Haas_Gantry_BIDC/Bechtel SR.cps @@ -281,7 +281,7 @@ properties = {/* description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: true, + value: false, scope: "post" } }; @@ -663,8 +663,8 @@ function writeToolCycleBlock(tool) { } function prepareForToolCheck() { - onCommand(COMMAND_STOP_SPINDLE); - onCommand(COMMAND_COOLANT_OFF); + onCommand(COMMAND_STOP_SPINDLE, false); + onCommand(COMMAND_COOLANT_OFF, false); // cancel TCP so that tool doesn't follow tables if (currentSection.isMultiAxis() && (currentSection.getOptimizedTCPMode() == 0)) { @@ -678,28 +678,31 @@ function prepareForToolCheck() { } function BIDCWriteToolMeasureBlock(tool, rotating) { - writeBlock(gFormat.format(43), hFormat.format(tool.number)); + + var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + + writeFunction(gFormat.format(43), hFormat.format(tool.number)); if (rotating && tool.type != HAAS_BALL_NOSE) { - writeBlock(gFormat.format(59), gFormat.format(0), xOutput.format(-tool.diameter/2), yOutput.format(0)); + writeFunction(gFormat.format(59), gFormat.format(0), xOutput.format(-tool.diameter/2), yOutput.format(0)); } else { - writeBlock(gFormat.format(59), gFormat.format(0), xOutput.format(0), yOutput.format(0)); + writeFunction(gFormat.format(59), gFormat.format(0), xOutput.format(0), yOutput.format(0)); } - writeBlock(mFormat.format(0)); + writeFunction(mFormat.format(0)); writeComment("TOOL PROBING"); - writeBlock(mFormat.format(83)); - writeBlock(gFormat.format(4), "P1."); - writeBlock(mFormat.format(84)); + writeFunction(mFormat.format(83)); + writeFunction(gFormat.format(4), "P1."); + writeFunction(mFormat.format(84)); if (rotating) { - writeBlock(sOutput.format(400), mFormat.format(!tool.clockwise ? 3 : 4)); + writeFunction(sOutput.format(400), mFormat.format(!tool.clockwise ? 3 : 4)); } - writeBlock(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(15)); - writeBlock(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); + writeFunction(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(15)); + writeFunction(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); if (rotating) { - writeBlock(sOutput.format(800)); + writeFunction(sOutput.format(800)); } - writeBlock(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(3)); - writeBlock(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); - onCommand(COMMAND_STOP_SPINDLE); + writeFunction(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(3)); + writeFunction(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); + onCommand(COMMAND_STOP_SPINDLE, !getProperty("measureToolsAtStart")); } function writeToolMeasureBlock(tool, preMeasure) { @@ -857,10 +860,10 @@ function onOpen() { var tool = tools.getTool(i); // Added 8/31/21 | Kevin Pan | pan261 if (tool.number == 1) { - throw "Tool number 1 is reserved for probing." + // throw "Tool number 1 is reserved for probing." } if (tool.number == 2) { - throw "Tool number 2 is not available for use." + // throw "Tool number 2 is not available for use." } // pan261 @@ -887,6 +890,9 @@ function onOpen() { // optionally cycle through all tools if (staticProperties.optionallyCycleToolsAtStart || staticProperties.optionallyMeasureToolsAtStart) { var tools = getToolTable(); + + var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + if (tools.getNumberOfTools() > 0) { /* @@ -920,10 +926,10 @@ function onOpen() { // writeRetract(Z); // } // writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - writeToolChange(tool.number) + writeToolChange(tool.number, !getProperty("measureToolsAtStart")) writeComment("SET LENGTH AND RADIUS"); - writeBlock(gFormat.format(10), "L" + 10, "P" + tool.number, "R" + (tool.holderLength + tool.bodyLength).toFixed(4)); - writeBlock(gFormat.format(10), "L" + 12, "P" + tool.number, "R" + (tool.diameter).toFixed(4)); + writeFunction(gFormat.format(10), "L" + 10, "P" + tool.number, "R" + (tool.holderLength + tool.bodyLength).toFixed(4)); + writeFunction(gFormat.format(10), "L" + 12, "P" + tool.number, "R" + (tool.diameter).toFixed(4)); writeComment("POSITION SPINDLE"); // writeBlock(gFormat.format(53), gFormat.format(0), xOutput.format(TOOL_CHANGE_X), yOutput.format(TOOL_CHANGE_Y)); // writeBlock(mFormat.format(0), formatComment("Load Tool " + tool.number)); //Pause until operator loads tool @@ -1014,7 +1020,7 @@ function onOpen() { } if (staticProperties.chipTransport) { - onCommand(COMMAND_START_CHIP_TRANSPORT); + onCommand(COMMAND_START_CHIP_TRANSPORT, false); } // Probing Surface Inspection if (typeof inspectionWriteVariables == "function") { @@ -1271,7 +1277,7 @@ function defineWorkPlane(_section, _setWorkPlane) { writeRetract(Z); } forceWorkPlane(); - onCommand(COMMAND_UNLOCK_MULTI_AXIS); + onCommand(COMMAND_UNLOCK_MULTI_AXIS, false); gMotionModal.reset(); writeBlock( gMotionModal.format(0), @@ -1315,7 +1321,7 @@ function setWorkPlane(abc) { } skipBlock = _skipBlock; - onCommand(COMMAND_UNLOCK_MULTI_AXIS); + onCommand(COMMAND_UNLOCK_MULTI_AXIS, false); gMotionModal.reset(); skipBlock = _skipBlock; @@ -1327,7 +1333,7 @@ function setWorkPlane(abc) { ); skipBlock = _skipBlock; - onCommand(COMMAND_LOCK_MULTI_AXIS); + onCommand(COMMAND_LOCK_MULTI_AXIS, false); currentWorkPlaneABC = abc; } @@ -1702,13 +1708,25 @@ function setAbsoluteMode(xyz, abc) { } } -function writeToolChange(toolNum) { - if (!retracted) { +function writeToolChange(toolNum, isOptional) { + if (isOptional) { + if (!retracted) { + skipBlock = true; + writeRetract(Z); + } + skipBlock = true; + writeRetract(X, Y); + writeOptionalBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool + skipBlock = true; + writeRetract(Z); + } else { + if (!retracted) { + writeRetract(Z); + } + writeRetract(X, Y); + writeBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool writeRetract(Z); } - writeRetract(X, Y); - writeBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool - writeRetract(Z); } function onSection() { @@ -1755,7 +1773,7 @@ function onSection() { if (staticProperties.fastToolChange && !isProbeOperation()) { currentCoolantMode = COOLANT_OFF; } else if (insertToolCall) { // no coolant off command if safe start operation - onCommand(COMMAND_COOLANT_OFF); + onCommand(COMMAND_COOLANT_OFF, false); } } @@ -1763,7 +1781,7 @@ function onSection() { // stop spindle before retract during tool change if (insertToolCall && !isFirstSection() && !toolChecked && !staticProperties.fastToolChange) { - onCommand(COMMAND_STOP_SPINDLE); + onCommand(COMMAND_STOP_SPINDLE, false); } // retract to safe plane @@ -1800,7 +1818,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) { @@ -1832,7 +1850,7 @@ function onSection() { if (insertToolCall || operationNeedsSafeStart) { if (!isFirstSection() && staticProperties.optionalStop && insertToolCall) { - onCommand(COMMAND_OPTIONAL_STOP); + onCommand(COMMAND_OPTIONAL_STOP, false); } if ((tool.number > 200 && tool.number < 1000) || tool.number > 9999) { @@ -1875,12 +1893,12 @@ function onSection() { // activate those two coolant modes before the spindle is turned on if ((tool.coolant == COOLANT_THROUGH_TOOL) || (tool.coolant == COOLANT_AIR_THROUGH_TOOL) || (tool.coolant == COOLANT_FLOOD_THROUGH_TOOL)) { if (!isFirstSection() && !insertToolCall && (currentCoolantMode != tool.coolant)) { - onCommand(COMMAND_STOP_SPINDLE); + onCommand(COMMAND_STOP_SPINDLE, false); forceSpindleSpeed = true; } setCoolant(tool.coolant); } else if ((currentCoolantMode == COOLANT_THROUGH_TOOL) || (currentCoolantMode == COOLANT_AIR_THROUGH_TOOL) || (currentCoolantMode == COOLANT_FLOOD_THROUGH_TOOL)) { - onCommand(COMMAND_STOP_SPINDLE); + onCommand(COMMAND_STOP_SPINDLE, false); setCoolant(COOLANT_OFF); forceSpindleSpeed = true; } @@ -3510,15 +3528,17 @@ var mapCommand = { COMMAND_LOAD_TOOL:6 }; -function onCommand(command) { +function onCommand(command, isOptional) { + var writeFunction = isOptional ? writeOptionalBlock : writeBlock; + switch (command) { case COMMAND_STOP: - writeBlock(mFormat.format(0)); + writeFunction(mFormat.format(0)); forceSpindleSpeed = true; forceCoolant = true; return; case COMMAND_OPTIONAL_STOP: - writeBlock(mFormat.format(1)); + writeFunction(mFormat.format(1)); forceSpindleSpeed = true; forceCoolant = true; return; @@ -3534,27 +3554,27 @@ function onCommand(command) { case COMMAND_LOCK_MULTI_AXIS: if (machineConfiguration.isMultiAxisConfiguration() && (machineConfiguration.getNumberOfAxes() >= 4)) { var _skipBlock = skipBlock; - writeBlock(mFormat.format(10)); // lock 4th-axis motion + writeFunction(mFormat.format(10)); // lock 4th-axis motion if (machineConfiguration.getNumberOfAxes() == 5) { skipBlock = _skipBlock; - writeBlock(mFormat.format(12)); // lock 5th-axis motion + writeFunction(mFormat.format(12)); // lock 5th-axis motion } } return; case COMMAND_UNLOCK_MULTI_AXIS: if (machineConfiguration.isMultiAxisConfiguration() && (machineConfiguration.getNumberOfAxes() >= 4)) { var _skipBlock = skipBlock; - writeBlock(mFormat.format(11)); // unlock 4th-axis motion + writeFunction(mFormat.format(11)); // unlock 4th-axis motion if (machineConfiguration.getNumberOfAxes() == 5) { skipBlock = _skipBlock; - writeBlock(mFormat.format(13)); // unlock 5th-axis motion + writeFunction(mFormat.format(13)); // unlock 5th-axis motion } } return; case COMMAND_BREAK_CONTROL: if (!toolChecked) { // avoid duplicate COMMAND_BREAK_CONTROL prepareForToolCheck(); - writeBlock( + writeFunction( gFormat.format(65), "P" + 9853, "T" + toolFormat.format(tool.number), @@ -3569,10 +3589,10 @@ function onCommand(command) { measureTool = true; return; case COMMAND_START_CHIP_TRANSPORT: - writeBlock(mFormat.format(31)); + writeFunction(mFormat.format(31)); return; case COMMAND_STOP_CHIP_TRANSPORT: - writeBlock(mFormat.format(33)); + writeFunction(mFormat.format(33)); return; case COMMAND_PROBE_ON: return; @@ -3583,7 +3603,7 @@ function onCommand(command) { var stringId = getCommandStringId(command); var mcode = mapCommand[stringId]; if (mcode != undefined) { - writeBlock(mFormat.format(mcode)); + writeFunction(mFormat.format(mcode)); } else { onUnsupportedCommand(command); } @@ -3606,7 +3626,7 @@ function onSectionEnd() { if ((((getCurrentSectionId() + 1) >= getNumberOfSections()) || (tool.number != getNextSection().getTool().number)) && tool.breakControl) { - onCommand(COMMAND_BREAK_CONTROL); + onCommand(COMMAND_BREAK_CONTROL, false); } else { toolChecked = false; } @@ -3838,8 +3858,8 @@ function onClose() { optionalSection = false; - onCommand(COMMAND_STOP_SPINDLE); - onCommand(COMMAND_COOLANT_OFF); + onCommand(COMMAND_STOP_SPINDLE, false); + onCommand(COMMAND_COOLANT_OFF, false); // retract writeRetract(Z); From b3ec9e5a591d7e61a8644eb1522575aad8ee7f74 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 9 Sep 2021 19:45:07 -0400 Subject: [PATCH 09/17] Updated setup sheet styling --- Autodesk_Setup_BIDC/setup-sheet.cps | 4 +++- Autodesk_Setup_BIDC/setup-sheet.css | 35 ++++++++++++++++++----------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Autodesk_Setup_BIDC/setup-sheet.cps b/Autodesk_Setup_BIDC/setup-sheet.cps index d140fca..e857a64 100644 --- a/Autodesk_Setup_BIDC/setup-sheet.cps +++ b/Autodesk_Setup_BIDC/setup-sheet.cps @@ -32,7 +32,7 @@ properties = { title: "Embed stylesheet", description: "Embeds the stylesheet in the HTML code.", type: "boolean", - value: true, + value: false, scope: "post" }, useUnitSymbol: { @@ -1367,6 +1367,8 @@ function onSectionEnd() { src = encodeURIComponent(modelImagePath); } } + + src = "https://photos.app.goo.gl/thhzYbzUsw1zCk5Q9"; ++numberOfColumns; var alignment = (numberOfColumns <= 1) ? "center" : "right"; diff --git a/Autodesk_Setup_BIDC/setup-sheet.css b/Autodesk_Setup_BIDC/setup-sheet.css index 0368030..1e437f9 100644 --- a/Autodesk_Setup_BIDC/setup-sheet.css +++ b/Autodesk_Setup_BIDC/setup-sheet.css @@ -4,14 +4,17 @@ All rights reserved */ +@import url("https://use.typekit.net/sgs7pgb.css"); + body { - background-color: White; - font-family: Arial, Helvetica, sans-serif; + background-color: #CFB991; + font-family: acumin-pro, 'Franklin Gothic', sans-serif; } h1 { - font-size: 15pt; + font-size: 2.5rem; text-align: center; + font-weight: 700; } h2 { @@ -29,20 +32,23 @@ h3.section { table { border: none; border-spacing: 0; + background-color: white; } table.jobhead { width: 18cm; + background-color: #CFB991; } table.job, table.sheet { width: 18cm; - border: thin solid Gray; + border: medium solid Black; } th { background-color: #e0e0e0; - border-bottom: 1px solid Gray; + border-bottom: medium solid Black; + padding: 0.7rem; } tr.space td { @@ -78,6 +84,7 @@ tr { padding-top: 30px; padding-bottom: 20px; white-space: nowrap; + font-size: 1.5625rem; } .even td { @@ -94,7 +101,7 @@ tr { } td { - font-size: 9pt; + font-size: 1.125rem; vertical-align: top; } @@ -112,7 +119,8 @@ td.image { pre { padding-left: 0.5cm; - font-size: 8pt; + font-size: 1.125rem; + font-style: italic; } p { @@ -124,18 +132,19 @@ p { .jobhead td .description { display: inline; - font-variant: small-caps; + font-variant: normal; } td .description { - font-size: 8pt; + font-size: 1.125rem; display: inline; - font-variant: small-caps; + font-variant: normal; + font-weight: bold; } .value { display: inline; - font-family: Geneva, sans-serif; + font-family: acumin-pro, sans-serif; color: #606060; } @@ -176,9 +185,9 @@ path.cutter { } path.holderIE { - stroke-width: 0; // non-scaling not worker + stroke-width: 0; } path.cutterIE { - stroke-width: 0; // non-scaling not worker + stroke-width: 0; } From 0d58ddcbe705937c7f4bdc499052d8d423825837 Mon Sep 17 00:00:00 2001 From: pan261 Date: Tue, 14 Sep 2021 12:39:24 -0400 Subject: [PATCH 10/17] Changed H19 -> H1 for Verify WCS --- Haas_Gantry_BIDC/Bechtel SR.cps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Haas_Gantry_BIDC/Bechtel SR.cps b/Haas_Gantry_BIDC/Bechtel SR.cps index f92d238..38d9c2b 100644 --- a/Haas_Gantry_BIDC/Bechtel SR.cps +++ b/Haas_Gantry_BIDC/Bechtel SR.cps @@ -1743,7 +1743,7 @@ function onSection() { writeBlock(mFormat.format(0)); writeComment("Is the pencil centered above your stock?"); - writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); + writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(1), zOutput.format(stockTopZ)); writeBlock(mFormat.format(0)); writeComment("Is the pencil touching your stock?"); } From 05921f4059a5419c87652409c251d062ad131cba Mon Sep 17 00:00:00 2001 From: pan261 Date: Tue, 14 Sep 2021 12:41:35 -0400 Subject: [PATCH 11/17] reverted custom image in setup sheet --- Autodesk_Setup_BIDC/setup-sheet.cps | 2 -- 1 file changed, 2 deletions(-) diff --git a/Autodesk_Setup_BIDC/setup-sheet.cps b/Autodesk_Setup_BIDC/setup-sheet.cps index e857a64..ac44f22 100644 --- a/Autodesk_Setup_BIDC/setup-sheet.cps +++ b/Autodesk_Setup_BIDC/setup-sheet.cps @@ -1367,8 +1367,6 @@ function onSectionEnd() { src = encodeURIComponent(modelImagePath); } } - - src = "https://photos.app.goo.gl/thhzYbzUsw1zCk5Q9"; ++numberOfColumns; var alignment = (numberOfColumns <= 1) ? "center" : "right"; From 218a3998b9b8b5bd0b1c2676d4aa6bf83c7cf8a0 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 16 Sep 2021 12:31:47 -0400 Subject: [PATCH 12/17] Squashed commit of the following: commit d584dba8256dc9d22dc0681bf7908cb4767d884e Author: Williams, Gavin J Date: Thu Sep 16 11:54:12 2021 -0400 Added Dwell for coolant commit 72bcd9306acd06cf33c1ff0b5ff5a628fa2cbfbd Author: pan261 Date: Tue Sep 14 13:54:42 2021 -0400 FIxed tool validation checking in Mills commit 3ce1950882af0bf108c01f3b78bccd3ea14cd121 Author: Williams, Gavin J Date: Tue Sep 14 13:42:18 2021 -0400 Added Tool Selection commit ca32b19316c66d5d1acce74ec65a4336c1e6be76 Author: pan261 Date: Tue Sep 14 12:44:01 2021 -0400 Changed H19 -> H1 for Verify WCS --- Haas_Gantry_BIDC/Bechtel SR.cps | 60 +++++++++++++++++++++++++++++++-- Haas_Mills_BIDC/Bechtel DT.cps | 5 ++- Haas_Mills_BIDC/Bechtel VF2.cps | 5 ++- Haas_Mills_BIDC/Bechtel VF4.cps | 3 +- 4 files changed, 68 insertions(+), 5 deletions(-) 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 From 6fb2f7e715f36fcd302223b3062c208e8c0e2351 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 16 Sep 2021 16:56:38 -0400 Subject: [PATCH 13/17] Squashed commit of the following: commit 379fe6b23050dbf928fb16d6c4c2a8140a219e66 Author: Williams, Gavin J Date: Thu Sep 16 14:35:30 2021 -0400 Removed User Selected Axis commit eaa3131b240038233f38c12c5cfb7af2cd57d564 Author: will1742 Date: Thu Sep 16 14:17:57 2021 -0400 Removed Manual A,B,C Selection commit a6a840a000e7df5116616cadd3afa16bcb645b79 Author: will1742 Date: Thu Sep 16 14:12:04 2021 -0400 Added Debug Mode and Feed Cancel commit d584dba8256dc9d22dc0681bf7908cb4767d884e Author: Williams, Gavin J Date: Thu Sep 16 11:54:12 2021 -0400 Added Dwell for coolant commit 72bcd9306acd06cf33c1ff0b5ff5a628fa2cbfbd Author: pan261 Date: Tue Sep 14 13:54:42 2021 -0400 FIxed tool validation checking in Mills commit 3ce1950882af0bf108c01f3b78bccd3ea14cd121 Author: Williams, Gavin J Date: Tue Sep 14 13:42:18 2021 -0400 Added Tool Selection commit ca32b19316c66d5d1acce74ec65a4336c1e6be76 Author: pan261 Date: Tue Sep 14 12:44:01 2021 -0400 Changed H19 -> H1 for Verify WCS --- Flow_Waterjet_BIDC/Bechtel Waterjet.cps | 81 +++++++++++++++---------- Haas_Mills_BIDC/Bechtel DT.cps | 29 ++++----- Haas_Mills_BIDC/Bechtel VF2.cps | 29 ++++----- Haas_Mills_BIDC/Bechtel VF4.cps | 35 ++++++----- 4 files changed, 98 insertions(+), 76 deletions(-) diff --git a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps index 05ad654..57fd684 100644 --- a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps +++ b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps @@ -21,7 +21,7 @@ longDescription = "Post for Flow Waterjets using software Version 5 or 6. V5=2-a "V5: Manually set nozzle height. V6: Nozzle height in NC program set by Top Height attribute. " + EOL + "Feed percentage set by Cutting Mode quality in tool dialog (auto=60, high=20, medium=40, low=100)"; -extension = "ORD"; +extension = "ord"; setCodePage("ascii"); capabilities = CAPABILITY_JET; @@ -68,6 +68,13 @@ properties = { ], value: "6", scope: "post" + }, + debugMode: { + title: "Debug Mode", + description: "Display Comments in ORD. Not compatible with machine", + type: "boolean", + value: false, + scope: "post" } }; @@ -87,6 +94,8 @@ var lineCounter = -1; // collected state var useVersion6 = false; var arcFinish = undefined; +var feedActive = false; +var prevCoords = undefined; // override radius compensation var compensationOffset = 0; // center compensation @@ -106,6 +115,7 @@ function formatComment(comment) { } function writeComment(text) { + if (!getProperty("debugMode")) return; writeln(formatComment(text.substr(0, maximumLineLength - 2))); } @@ -218,13 +228,6 @@ 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); } @@ -256,14 +259,16 @@ function writeLinear(x, y, z, feed, column7) { writeComment("Arc Completion"); break; } - writeBlock( - commentf("X"), ",", - f("Y"), ",", - f("Z"), ",", - fi("L", 2), ",", - fi("Feed", 5), ",", - fi("C", 2), ",", - fi("?", 2)); + if (getProperty("debugMode")){ + 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)), ",", @@ -285,7 +290,6 @@ function writeLinear(x, y, z, feed, column7) { 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)), ",", @@ -297,7 +301,10 @@ function writeLinear(x, y, z, feed, column7) { ++lineCounter; forceOutput = false; } - + if (feed > 0) { + feedActive = true; + } + prevCoords = {x:x, y:y, z:z}; } function finishArcs() { @@ -311,7 +318,12 @@ function finishArcs() { function onRapid(x, y, z) { finishArcs(); + if (feedActive) { + forceOutput = true; + writeLinear(prevCoords.x, prevCoords.y, prevCoords.z, 0, 0); + } writeLinear(x, y, z, 0, 0); // non-cutting + feedActive = false; } function onLinear(x, y, z, feed) { @@ -342,17 +354,19 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { var p = getCurrentPosition(); if (useVersion6) { writeComment("Circular"); - writeBlock( - commentf("X"), ",", - f("Y"), ",", - f("Z"), ",", - fi("CW", 2), ",", - fi("Feed", 5), ",", - fi("C", 2), ",", - fi("?", 2), ",", - f("CX"), ",", - f("CY"), ",", - f("CZ")); + if (getProperty("debugMode")){ + writeBlock( + commentf("X"), ",", + f("Y"), ",", + f("Z"), ",", + fi("CW", 2), ",", + fi("Feed", 5), ",", + fi("C", 2), ",", + fi("?", 2), ",", + f("CX"), ",", + f("CY"), ",", + f("CZ")); + } writeBlock( f(xyzFormat.format(p.x)), ",", f(xyzFormat.format(p.y)), ",", @@ -381,7 +395,10 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { // save destination values to complete arc move arcFinish = {x:x, y:y, z:z, feed:(power ? getFeedInPercent(feed) : 0)}; - + if (feed > 0) { + feedActive = true; + } + prevCoords = {x:x, y:y, z:z}; } function getFeedInPercent(feed) { @@ -451,11 +468,11 @@ function onClose() { writeComment("Filename: " + getGlobalParameter("document-path")); writeComment("Date: " + getGlobalParameter("generated-at")); writeComment("Post Version: " + staticProperties.postVersion); - // writeln("// This file was created by FlowMaster(R), which is proprietary to Flow International Corporation. " + lineCounter + " " + arcCounter); + 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); } diff --git a/Haas_Mills_BIDC/Bechtel DT.cps b/Haas_Mills_BIDC/Bechtel DT.cps index a7d8a35..c618ce4 100644 --- a/Haas_Mills_BIDC/Bechtel DT.cps +++ b/Haas_Mills_BIDC/Bechtel DT.cps @@ -71,7 +71,7 @@ properties = {/* ], value: "none", scope: "post" - },*/ + }, hasAAxis: { title: "Has A-axis rotary", description: "Enable if the machine has an A-axis table/trunnion. Check the table direction on the machine and use the (Reversed) selection if the table is moving in the opposite direction.", @@ -110,7 +110,7 @@ properties = {/* ], value: "false", scope: "post" - },/* + }, throughSpindle: { title: "Allow Through Spindle Coolant", description: "Enables through spindle coolant, if off uses flood", @@ -417,7 +417,7 @@ properties = {/* }, toolLengthValidation: { title: "Tool Length Validation", - description: "Length validation. By turning this off, you accept responsibility for any resulting crashes.", + description: "Length validation. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -425,7 +425,7 @@ properties = {/* }, pencilWCSValidation: { title: "WCS Validation", - description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", + description: "WCS validation. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -433,7 +433,7 @@ properties = {/* }, measureToolsAtStart: { title: "Tool Probing", - description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", + description: "Tool Probing. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -441,7 +441,7 @@ properties = {/* }, loadToolsAtStart: { title: "Tool Loading", - description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", + description: "Tool Loading. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -486,6 +486,9 @@ staticProperties = { coolantPressure: "", singleResultsFile: true, useP9995: true, + hasAAxis: "false", + hasBAxis: "false", + hasCAxis: "false", postVersion: "DT1G8A21" }; @@ -897,7 +900,6 @@ function prepareForToolCheck() { function writeToolMeasureBlock(tool, preMeasure) { var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; - // var writeFunction = writeBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { prepareForToolCheck(); @@ -1098,9 +1100,9 @@ function setFeedrateMode(reset) { } function defineMachine() { - hasA = getProperty("hasAAxis") != "false"; - hasB = getProperty("hasBAxis") != "false"; - hasC = getProperty("hasCAxis") != "false"; + hasA = staticProperties.hasAAxis != "false"; + hasB = staticProperties.hasBAxis != "false"; + hasC = staticProperties.hasCAxis != "false"; if (hasA && hasB && hasC) { error(localize("Only two rotary axes can be active at the same time.")); @@ -1119,7 +1121,7 @@ function defineMachine() { var cAxis; var useTCPC = getProperty("useTCPC"); if (hasA) { // A Axis - For horizontal machines and trunnions - var dir = getProperty("hasAAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasAAxis == "reversed" ? -1 : 1; if (hasC || hasB) { var aMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var aMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -1130,7 +1132,7 @@ function defineMachine() { } if (hasB) { // B Axis - For horizontal machines and trunnions - var dir = getProperty("hasBAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasBAxis == "reversed" ? -1 : 1; if (hasC) { var bMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var bMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -1143,7 +1145,7 @@ function defineMachine() { } if (hasC) { // C Axis - For trunnions only - var dir = getProperty("hasCAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasCAxis == "reversed" ? -1 : 1; cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, dir], cyclic:true, reset:1, tcp:useTCPC}); } @@ -1441,7 +1443,6 @@ function onOpen() { comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); } comment += " - " + getToolTypeName(tool.type); - writeComment(tool.description); writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index b46e4c2..091fbfc 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -71,7 +71,7 @@ properties = {/* ], value: "none", scope: "post" - },*/ + }, hasAAxis: { title: "Has A-axis rotary", description: "Enable if the machine has an A-axis table/trunnion. Check the table direction on the machine and use the (Reversed) selection if the table is moving in the opposite direction.", @@ -110,7 +110,7 @@ properties = {/* ], value: "false", scope: "post" - },/* + }, throughSpindle: { title: "Allow Through Spindle Coolant", description: "Enables through spindle coolant, if off uses flood", @@ -417,7 +417,7 @@ properties = {/* }, toolLengthValidation: { title: "Tool Length Validation", - description: "Length validation. By turning this off, you accept responsibility for any resulting crashes.", + description: "Length validation. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -425,7 +425,7 @@ properties = {/* }, pencilWCSValidation: { title: "WCS Validation", - description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", + description: "WCS validation. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -433,7 +433,7 @@ properties = {/* }, measureToolsAtStart: { title: "Tool Probing", - description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", + description: "Tool Probing. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -441,7 +441,7 @@ properties = {/* }, loadToolsAtStart: { title: "Tool Loading", - description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", + description: "Tool Loading. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -486,6 +486,9 @@ staticProperties = { coolantPressure: "", singleResultsFile: true, useP9995: true, + hasAAxis: "false", + hasBAxis: "false", + hasCAxis: "false", postVersion: "VF2G8A21" }; @@ -897,7 +900,6 @@ function prepareForToolCheck() { function writeToolMeasureBlock(tool, preMeasure) { var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; - var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { prepareForToolCheck(); @@ -1098,9 +1100,9 @@ function setFeedrateMode(reset) { } function defineMachine() { - hasA = getProperty("hasAAxis") != "false"; - hasB = getProperty("hasBAxis") != "false"; - hasC = getProperty("hasCAxis") != "false"; + hasA = staticProperties.hasAAxis != "false"; + hasB = staticProperties.hasBAxis != "false"; + hasC = staticProperties.hasCAxis != "false"; if (hasA && hasB && hasC) { error(localize("Only two rotary axes can be active at the same time.")); @@ -1119,7 +1121,7 @@ function defineMachine() { var cAxis; var useTCPC = getProperty("useTCPC"); if (hasA) { // A Axis - For horizontal machines and trunnions - var dir = getProperty("hasAAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasAAxis == "reversed" ? -1 : 1; if (hasC || hasB) { var aMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var aMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -1130,7 +1132,7 @@ function defineMachine() { } if (hasB) { // B Axis - For horizontal machines and trunnions - var dir = getProperty("hasBAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasBAxis == "reversed" ? -1 : 1; if (hasC) { var bMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var bMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -1143,7 +1145,7 @@ function defineMachine() { } if (hasC) { // C Axis - For trunnions only - var dir = getProperty("hasCAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasCAxis == "reversed" ? -1 : 1; cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, dir], cyclic:true, reset:1, tcp:useTCPC}); } @@ -1441,7 +1443,6 @@ function onOpen() { comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); } comment += " - " + getToolTypeName(tool.type); - writeComment(tool.description); writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool displayMedia("toolLoad" + tool.number + ".jpg", !getProperty("loadToolsAtStart")); diff --git a/Haas_Mills_BIDC/Bechtel VF4.cps b/Haas_Mills_BIDC/Bechtel VF4.cps index 7522560..359bc34 100644 --- a/Haas_Mills_BIDC/Bechtel VF4.cps +++ b/Haas_Mills_BIDC/Bechtel VF4.cps @@ -71,7 +71,7 @@ properties = {/* ], value: "none", scope: "post" - },*/ + }, hasAAxis: { title: "Has A-axis rotary", description: "Enable if the machine has an A-axis table/trunnion. Check the table direction on the machine and use the (Reversed) selection if the table is moving in the opposite direction.", @@ -110,7 +110,7 @@ properties = {/* ], value: "false", scope: "post" - },/* + }, throughSpindle: { title: "Allow Through Spindle Coolant", description: "Enables through spindle coolant, if off uses flood", @@ -417,7 +417,7 @@ properties = {/* }, toolLengthValidation: { title: "Tool Length Validation", - description: "Length validation. By turning this off, you accept responsibility for any resulting crashes.", + description: "Length validation. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -425,7 +425,7 @@ properties = {/* }, pencilWCSValidation: { title: "WCS Validation", - description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", + description: "WCS validation. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -433,7 +433,7 @@ properties = {/* }, measureToolsAtStart: { title: "Tool Probing", - description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", + description: "Tool Probing. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -441,7 +441,7 @@ properties = {/* }, loadToolsAtStart: { title: "Tool Loading", - description: "Tool Loading. By turning this off, you accept responsibility for any resulting crashes.", + description: "Tool Loading. By setting this to optional, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", value: true, @@ -486,6 +486,9 @@ staticProperties = { coolantPressure: "", singleResultsFile: true, useP9995: true, + hasAAxis: "false", + hasBAxis: "false", + hasCAxis: "false", postVersion: "VF4G8A21" }; @@ -896,7 +899,6 @@ function prepareForToolCheck() { function writeToolMeasureBlock(tool, preMeasure) { var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; - // var writeFunction = writeBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { prepareForToolCheck(); @@ -1097,9 +1099,9 @@ function setFeedrateMode(reset) { } function defineMachine() { - hasA = getProperty("hasAAxis") != "false"; - hasB = getProperty("hasBAxis") != "false"; - hasC = getProperty("hasCAxis") != "false"; + hasA = staticProperties.hasAAxis != "false"; + hasB = staticProperties.hasBAxis != "false"; + hasC = staticProperties.hasCAxis != "false"; if (hasA && hasB && hasC) { error(localize("Only two rotary axes can be active at the same time.")); @@ -1118,7 +1120,7 @@ function defineMachine() { var cAxis; var useTCPC = getProperty("useTCPC"); if (hasA) { // A Axis - For horizontal machines and trunnions - var dir = getProperty("hasAAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasAAxis == "reversed" ? -1 : 1; if (hasC || hasB) { var aMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var aMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -1129,7 +1131,7 @@ function defineMachine() { } if (hasB) { // B Axis - For horizontal machines and trunnions - var dir = getProperty("hasBAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasBAxis == "reversed" ? -1 : 1; if (hasC) { var bMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var bMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -1142,7 +1144,7 @@ function defineMachine() { } if (hasC) { // C Axis - For trunnions only - var dir = getProperty("hasCAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasCAxis == "reversed" ? -1 : 1; cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, dir], cyclic:true, reset:1, tcp:useTCPC}); } @@ -2319,7 +2321,7 @@ function onSection() { // writeBlock(gFormat.format(53), "X" + macroFormat.format(100), yOutput.format(0)); writeBlock(gFormat.format(55), gFormat.format(0), xOutput.format(Stock_X_55)); writeBlock(gFormat.format(53), gFormat.format(0), yOutput.format(0)); - displayMedia("loadStock.jpg"); + displayMedia("loadStock.jpg", false); writeBlock(mFormat.format(0)); } @@ -2335,9 +2337,9 @@ function onSection() { writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool writeBlock(gFormat.format(55), gFormat.format(0), forceX.format(stockMidX), forceY.format(stockMidY)); - if (getProperty("hasAAxis") != "false" && getProperty("hasCAxis") != "false") { + if (staticProperties.hasAAxis != "false" && staticProperties.hasCAxis != "false") { writeBlock(gFormat.format(0), aOutput.format(0), cOutput.format(0)); - } else if (getProperty("hasAAxis") != "false") { + } else if (staticProperties.hasAAxis != "false") { writeBlock(gFormat.format(0), aOutput.format(0)); } displayMedia("xyWCSCheck.jpg", false); @@ -2820,6 +2822,7 @@ function onSection() { if (tool.type != TOOL_PROBE) { setCoolant(tool.coolant); + writeBlock(gFormat.format(4), "P500"); } writeComment("BEGIN OPERATION"); From dd3f8c9514019953562fe21d3275c42d3ac49f03 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 16 Sep 2021 18:41:51 -0400 Subject: [PATCH 14/17] Started waterjet .sta file generation code --- Flow_Waterjet_BIDC/Bechtel Waterjet.cps | 75 +++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps index 57fd684..520cafa 100644 --- a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps +++ b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps @@ -103,6 +103,80 @@ var compensationOffset = 0; // center compensation var etchOperation = false; // though-cut unless set to true var forceOutput = false; +/** + * + * @param num + * @returns Little Endian hex string (float) + */ + function ToHex(num) { + if (num == 0) { + return "00000000"; //bypass + } + + var sign = "0"; + + if(num < 0.0) { + sign = "1"; + num = -num; + } + + var mantissa = parseFloat(num).toString(2); + var exponent = 0; + + if (mantissa.indexOf('.') == -1) { + mantissa = mantissa.toString() + ".0"; + } + + if (mantissa.substr(0, 1) === "0") { + exponent = mantissa.indexOf('.') - mantissa.indexOf('1') + 127; + } + else { + exponent = mantissa.indexOf('.') - 1 + 127; + } + + mantissa = mantissa.replace(".", ""); + mantissa = mantissa.substr(mantissa.indexOf('1') + 1); + + if (mantissa.length > 23) { + mantissa = mantissa.substr(0, 23); + } + else { + while (mantissa.length < 23) { + mantissa = mantissa + "0"; + } + } + + var exp = parseFloat(exponent).toString(2); + + while(exp.length < 8) { + exp = "0" + exp; + } + + var numberFull = sign + exp + mantissa; + return parseInt(numberFull, 2).toString(16); + +} + +/** + * (IN PROGRESS) Write machine config to .sta file + */ +function writeSta() { + try { + var file = new TextFile("C:\\Users\\" + getGlobalParameter("username") + "\\AppData\\Local\\Fusion 360 CAM\\nc\\hello.txt", true, "utf-8"); + + var float = 9.94; + + + file.writeln(ToHex(6.0)); + + file.close(); + + } catch (e) { + error(localize("Failed to write sta file.")); + } + +} + /** Writes the specified block. */ @@ -451,6 +525,7 @@ function onSectionEnd() { } function onClose() { + writeSta(); if (isRedirecting()) { var mainProgram = getRedirectionBuffer(); // TAG: no need for redirection closeRedirection(); From d49eec0269adece53589358b806ae3bf32e0f054 Mon Sep 17 00:00:00 2001 From: pan261 Date: Tue, 21 Sep 2021 12:11:19 -0400 Subject: [PATCH 15/17] update on waterjet .sta file --- Flow_Waterjet_BIDC/Bechtel Waterjet.cps | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps index 520cafa..7733e5e 100644 --- a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps +++ b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps @@ -153,8 +153,8 @@ var forceOutput = false; } var numberFull = sign + exp + mantissa; - return parseInt(numberFull, 2).toString(16); - + var hex = parseInt(numberFull, 2).toString(16).split(''); + return (hex[6] + hex[7]) + (hex[4] + hex[5]) + (hex[2] + hex[3]) + (hex[0] + hex[1]); } /** @@ -162,12 +162,13 @@ var forceOutput = false; */ function writeSta() { try { - var file = new TextFile("C:\\Users\\" + getGlobalParameter("username") + "\\AppData\\Local\\Fusion 360 CAM\\nc\\hello.txt", true, "utf-8"); - + var file = new TextFile("C:\\Users\\" + getGlobalParameter("username") + "\\AppData\\Local\\Fusion 360 CAM\\nc\\" + programName + ".sta", true, "utf-8"); var float = 9.94; - - - file.writeln(ToHex(6.0)); + + var data = BinaryFile.loadBinary("C:\\Users\\kpan8\\Downloads\\stazip\\ld6.sta"); + var hex = toHex(6.0); + data = String.fromCharCode(hex[0] + hex[1]) + String.fromCharCode(hex[2] + hex[3]) + String.fromCharCode(hex[4] + hex[5]) + String.fromCharCode(hex[6] + hex[7]); + file.writeln(data); file.close(); From 725feaad436fba9d6e12ceba751293a6d7896487 Mon Sep 17 00:00:00 2001 From: pan261 Date: Thu, 23 Sep 2021 12:24:04 -0400 Subject: [PATCH 16/17] tested waterjet writing binary file --- Flow_Waterjet_BIDC/Bechtel Waterjet.cps | 1125 ++++++++++++----------- 1 file changed, 564 insertions(+), 561 deletions(-) diff --git a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps index 7733e5e..1ee6df6 100644 --- a/Flow_Waterjet_BIDC/Bechtel Waterjet.cps +++ b/Flow_Waterjet_BIDC/Bechtel Waterjet.cps @@ -1,561 +1,564 @@ -/** - Copyright (C) 2012-2021 by Autodesk, Inc. - All rights reserved. - - Flow waterjet post processor configuration. - - $Revision: 43151 08c79bb5b30997ccb5fb33ab8e7c8c26981be334 $ - $Date: 2021-02-19 00:25:13 $ - - FORKID {F61954EF-5A29-4B93-93E7-870BC2786880} -*/ - -description = "Flow Waterjet ORD"; -vendor = "Flow"; -vendorUrl = "http://www.flowwaterjet.com"; -legal = "Copyright (C) 2012-2021 by Autodesk, Inc."; -certificationLevel = 2; -minimumRevision = 45702; - -longDescription = "Post for Flow Waterjets using software Version 5 or 6. V5=2-axis, V6=3-axis. " + -"V5: Manually set nozzle height. V6: Nozzle height in NC program set by Top Height attribute. " + EOL + -"Feed percentage set by Cutting Mode quality in tool dialog (auto=60, high=20, medium=40, low=100)"; - -extension = "ord"; -setCodePage("ascii"); - -capabilities = CAPABILITY_JET; -tolerance = spatial(0.002, MM); - -minimumChordLength = spatial(0.25, MM); -minimumCircularRadius = spatial(0.01, MM); -maximumCircularRadius = spatial(1000, MM); -minimumCircularSweep = toRad(0.01); -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 -// version 5 does not have the mysterious parameter after the cutter comp value - -properties = { - useHSMFeedrates: { - title: "Use HSM feedrates", - description: "Specifies whether to output the feedrates from HSM.", - type: "boolean", - value: false, - scope: "post" - }, - maximumFeedrateIPM: { - title: "Maximum feedrate (IPM)", - description: "Sets the maximum feedrate in IPM.", - type: "integer", - value: 700, - scope: "post" - }, - formatVersion: { - title: "Flow control software version", - description: "V5 outputs XY, V6 outputs XYZ", - group: 1, - type: "enum", - values: [ - {title: "V5", id: "5"}, - {title: "V6", id: "6"} - ], - value: "6", - scope: "post" - }, - debugMode: { - title: "Debug Mode", - description: "Display Comments in ORD. Not compatible with machine", - type: "boolean", - value: false, - scope: "post" - } -}; - -staticProperties = { - postVersion: "BIDC-FWJ.G9.A21" -}; - -// use fixed width instead -var xyzFormat = createFormat({decimals:4, trim:false}); -var integerFormat = createFormat({decimals:0}); - -// fixed settings -var thickness = 0; -var arcCounter = 0; -var lineCounter = -1; - -// collected state -var useVersion6 = false; -var arcFinish = undefined; -var feedActive = false; -var prevCoords = undefined; - -// override radius compensation -var compensationOffset = 0; // center compensation - -var etchOperation = false; // though-cut unless set to true -var forceOutput = false; - -/** - * - * @param num - * @returns Little Endian hex string (float) - */ - function ToHex(num) { - if (num == 0) { - return "00000000"; //bypass - } - - var sign = "0"; - - if(num < 0.0) { - sign = "1"; - num = -num; - } - - var mantissa = parseFloat(num).toString(2); - var exponent = 0; - - if (mantissa.indexOf('.') == -1) { - mantissa = mantissa.toString() + ".0"; - } - - if (mantissa.substr(0, 1) === "0") { - exponent = mantissa.indexOf('.') - mantissa.indexOf('1') + 127; - } - else { - exponent = mantissa.indexOf('.') - 1 + 127; - } - - mantissa = mantissa.replace(".", ""); - mantissa = mantissa.substr(mantissa.indexOf('1') + 1); - - if (mantissa.length > 23) { - mantissa = mantissa.substr(0, 23); - } - else { - while (mantissa.length < 23) { - mantissa = mantissa + "0"; - } - } - - var exp = parseFloat(exponent).toString(2); - - while(exp.length < 8) { - exp = "0" + exp; - } - - var numberFull = sign + exp + mantissa; - var hex = parseInt(numberFull, 2).toString(16).split(''); - return (hex[6] + hex[7]) + (hex[4] + hex[5]) + (hex[2] + hex[3]) + (hex[0] + hex[1]); -} - -/** - * (IN PROGRESS) Write machine config to .sta file - */ -function writeSta() { - try { - var file = new TextFile("C:\\Users\\" + getGlobalParameter("username") + "\\AppData\\Local\\Fusion 360 CAM\\nc\\" + programName + ".sta", true, "utf-8"); - var float = 9.94; - - var data = BinaryFile.loadBinary("C:\\Users\\kpan8\\Downloads\\stazip\\ld6.sta"); - var hex = toHex(6.0); - data = String.fromCharCode(hex[0] + hex[1]) + String.fromCharCode(hex[2] + hex[3]) + String.fromCharCode(hex[4] + hex[5]) + String.fromCharCode(hex[6] + hex[7]); - file.writeln(data); - - file.close(); - - } catch (e) { - error(localize("Failed to write sta file.")); - } - -} - -/** - Writes the specified block. -*/ -function writeBlock() { - writeWords(arguments); -} - -function formatComment(comment) { - return "// " + comment; -} - -function writeComment(text) { - if (!getProperty("debugMode")) return; - writeln(formatComment(text.substr(0, maximumLineLength - 2))); -} - -var FIELD = " "; - -/** Make sure fields are aligned. */ -function f(text) { - var length = text.length; - if (length > 10) { - return 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; - if (length > size) { - return text; - } - return FIELD.substr(0, size - length) + text; -} - -function onOpen() { - useVersion6 = getProperty("formatVersion") == "6"; - unit = IN; // only inch mode is supported - - redirectToBuffer(); // buffer the entire program to be able to count the linear and circular moves - setWordSeparator(""); - - { // stock - workpiece - var workpiece = getWorkpiece(); - var delta = Vector.diff(workpiece.upper, workpiece.lower); - if (delta.isNonZero()) { - // thickness = (workpiece.upper.z - workpiece.lower.z); - } - } - - if (getNumberOfSections() > 0) { - var firstSection = getSection(0); - - var remaining = firstSection.workPlane; - if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) { - error(localize("Tool orientation is not supported.")); - return; - } - setRotation(remaining); - - if (!useVersion6) { - var originZ = firstSection.getGlobalZRange().getMinimum(); // the cutting depth of the first section - - for (var i = 0; i < getNumberOfSections(); ++i) { - var section = getSection(i); - var z = section.getGlobalZRange().getMinimum(); // contour Z of the each section - if (xyzFormat.getResultingValue(z) != xyzFormat.getResultingValue(originZ)) { - error(localize("You are trying to machine at multiple depths which is not allowed.")); - return; - } - } - } - } - forceOutput = true;// force out first line -} - -function onSection() { - var remaining = currentSection.workPlane; - if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) { - error(localize("Tool orientation is not supported.")); - return; - } - setRotation(remaining); - - etchOperation = false; - if (currentSection.getType() == TYPE_JET) { - switch (tool.type) { - case TOOL_WATER_JET: - break; - default: - error(localize("The CNC does not support the required tool.")); - return; - } - switch (currentSection.jetMode) { - case JET_MODE_THROUGH: - break; - case JET_MODE_ETCHING: - etchOperation = true; - break; - case JET_MODE_VAPORIZE: - error(localize("Vaporize is not supported by the CNC.")); - return; - default: - error(localize("Unsupported cutting mode.")); - return; - } - } else if (currentSection.getType() == TYPE_MILLING) { - warning(localize("Milling toolpath will be used as waterjet through-cutting toolpath.")); - } else { - error(localize("CNC doesn't support the toolpath.")); - return; - } - - var initialPosition = getFramePosition(currentSection.getInitialPosition()); - onExpandedRapid(initialPosition.x, initialPosition.y, initialPosition.z); -} - -function onParameter(name, value) { -} - -function writeLinear(x, y, z, feed, column7) { - var flag = false; - if (useVersion6) { - flag = xyzFormat.areDifferent(x, getCurrentPosition().x) || - xyzFormat.areDifferent(y, getCurrentPosition().y) || - xyzFormat.areDifferent(z, getCurrentPosition().z); - } else { - flag = xyzFormat.areDifferent(x, getCurrentPosition().x) || - xyzFormat.areDifferent(y, getCurrentPosition().y); - } - - 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; - } - if (getProperty("debugMode")){ - 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)), ",", - f(xyzFormat.format(z)), ",", - fi(integerFormat.format(0), 2), ",", // linear - fi(integerFormat.format(feed), 5), ",", - fi(integerFormat.format(compensationOffset), 2), ",", // left, center, right - 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( - f(xyzFormat.format(x)), ",", - f(xyzFormat.format(y)), ",", - fi(integerFormat.format(0), 2), ",", - fi(integerFormat.format(feed), 5), ",", - fi(integerFormat.format(compensationOffset), 2) - ); - } - ++lineCounter; - forceOutput = false; - } - if (feed > 0) { - feedActive = true; - } - prevCoords = {x:x, y:y, z:z}; -} - -function finishArcs() { - if (arcFinish) { - // complete circular motion with output of destination values - forceOutput = true; - writeLinear(arcFinish.x, arcFinish.y, arcFinish.z, arcFinish.feed, 2); - arcFinish = undefined; - } -} - -function onRapid(x, y, z) { - finishArcs(); - if (feedActive) { - forceOutput = true; - writeLinear(prevCoords.x, prevCoords.y, prevCoords.z, 0, 0); - } - writeLinear(x, y, z, 0, 0); // non-cutting - feedActive = false; -} - -function onLinear(x, y, z, feed) { - finishArcs(); - // skip output if next move is an arc. OnCircular record has this move destination XY - if (getNextRecord().getType() != RECORD_CIRCULAR) { - writeLinear(x, y, z, power ? getFeedInPercent(feed) : 0, 2); - } -} - -function onPower(power) { -} - -function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { - // spirals are not allowed - arcs must be < 360deg - // fail if radius compensation is changed for circular move - - // syntax is; start X, start y, arc direction, feed, comp, cx, cy - // end X, end Y, if following move is an arc, is the start x, start y, of the line - // end X, end Y, if following move is a line, is output in OnLinear - // using the arcFinish flag - - circularICode = (clockwise ? 1 : -1); - - if ((getCircularPlane() != PLANE_XY) || isHelical()) { - linearize(tolerance); - } - var p = getCurrentPosition(); - if (useVersion6) { - writeComment("Circular"); - if (getProperty("debugMode")){ - writeBlock( - commentf("X"), ",", - f("Y"), ",", - f("Z"), ",", - fi("CW", 2), ",", - fi("Feed", 5), ",", - fi("C", 2), ",", - fi("?", 2), ",", - f("CX"), ",", - f("CY"), ",", - f("CZ")); - } - writeBlock( - f(xyzFormat.format(p.x)), ",", - f(xyzFormat.format(p.y)), ",", - f(xyzFormat.format(p.z)), ",", - fi(integerFormat.format(circularICode), 2), ",", // arc cw/ccw - fi(integerFormat.format(power ? getFeedInPercent(feed) : 0), 5), ",", - fi(integerFormat.format(compensationOffset), 2), ",", // left, center, right - fi(integerFormat.format(2), 2), ",", // TAG: seen -2..2 - unknown - f(xyzFormat.format(cx)), ",", - f(xyzFormat.format(cy)), ",", - f(xyzFormat.format(0)) // PLANE_XY only - ); - } else { - writeComment("Circular"); - writeBlock( - f(xyzFormat.format(p.x)), ",", - f(xyzFormat.format(p.y)), ",", - fi(integerFormat.format(circularICode), 2), ",", // arc cw/ccw - fi(integerFormat.format(power ? getFeedInPercent(feed) : 0), 5), ",", - fi(integerFormat.format(compensationOffset), 2), ",", // left, center, right - f(xyzFormat.format(cx)), ",", - f(xyzFormat.format(cy)) - ); - } - ++arcCounter; - - // save destination values to complete arc move - arcFinish = {x:x, y:y, z:z, feed:(power ? getFeedInPercent(feed) : 0)}; - if (feed > 0) { - feedActive = true; - } - prevCoords = {x:x, y:y, z:z}; -} - -function getFeedInPercent(feed) { - var feedPercent; - if ((getProperty("maximumFeedrateIPM") > 0) && getProperty("useHSMFeedrates")) { - // use HSM feedrates - // 1 - 99 % - feedPercent = Math.min(Math.ceil(Math.min(getProperty("maximumFeedrateIPM"), feed) / getProperty("maximumFeedrateIPM") * 100), 99); - } else { - // use fixed feedrates per quality selection - switch (currentSection.quality) { - case 1: - // high quality - feedPercent = 20; // very slow, cut surface excellent - break; - case 2: - feedPercent = 40; // slow, cut surface good - break; - case 3: - feedPercent = 100; // fast, cut surface slightly rough - break; - default: - // medium quality - feedPercent = 60; // moderate, cut surface moderate - } - } - return feedPercent; -} - -function onRadiusCompensation() { - switch (radiusCompensation) { - case RADIUS_COMPENSATION_LEFT: - compensationOffset = -1; - break; - case RADIUS_COMPENSATION_RIGHT: - compensationOffset = 1; - break; - default: - compensationOffset = 0; // center compensation - } -} - -function onCycle() { - error(localize("Canned cycles are not supported.")); -} - -function onSectionEnd() { - finishArcs(); - compensationOffset = 0; // center compensation -} - -function onClose() { - writeSta(); - if (isRedirecting()) { - var mainProgram = getRedirectionBuffer(); // TAG: no need for redirection - closeRedirection(); - 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("// 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"); - if (programComment) { - writeln("// " + programComment); - } - write(mainProgram); - } -} - -function setProperty(property, value) { - properties[property].current = value; -} +/** + Copyright (C) 2012-2021 by Autodesk, Inc. + All rights reserved. + + Flow waterjet post processor configuration. + + $Revision: 43151 08c79bb5b30997ccb5fb33ab8e7c8c26981be334 $ + $Date: 2021-02-19 00:25:13 $ + + FORKID {F61954EF-5A29-4B93-93E7-870BC2786880} +*/ + +description = "Flow Waterjet ORD"; +vendor = "Flow"; +vendorUrl = "http://www.flowwaterjet.com"; +legal = "Copyright (C) 2012-2021 by Autodesk, Inc."; +certificationLevel = 2; +minimumRevision = 45702; + +longDescription = "Post for Flow Waterjets using software Version 5 or 6. V5=2-axis, V6=3-axis. " + +"V5: Manually set nozzle height. V6: Nozzle height in NC program set by Top Height attribute. " + EOL + +"Feed percentage set by Cutting Mode quality in tool dialog (auto=60, high=20, medium=40, low=100)"; + +extension = "ord"; +setCodePage("ascii"); + +capabilities = CAPABILITY_JET; +tolerance = spatial(0.002, MM); + +minimumChordLength = spatial(0.25, MM); +minimumCircularRadius = spatial(0.01, MM); +maximumCircularRadius = spatial(1000, MM); +minimumCircularSweep = toRad(0.01); +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 +// version 5 does not have the mysterious parameter after the cutter comp value + +properties = { + useHSMFeedrates: { + title: "Use HSM feedrates", + description: "Specifies whether to output the feedrates from HSM.", + type: "boolean", + value: false, + scope: "post" + }, + maximumFeedrateIPM: { + title: "Maximum feedrate (IPM)", + description: "Sets the maximum feedrate in IPM.", + type: "integer", + value: 700, + scope: "post" + }, + formatVersion: { + title: "Flow control software version", + description: "V5 outputs XY, V6 outputs XYZ", + group: 1, + type: "enum", + values: [ + {title: "V5", id: "5"}, + {title: "V6", id: "6"} + ], + value: "6", + scope: "post" + }, + debugMode: { + title: "Debug Mode", + description: "Display Comments in ORD. Not compatible with machine", + type: "boolean", + value: false, + scope: "post" + } +}; + +staticProperties = { + postVersion: "BIDC-FWJ.G9.A21" +}; + +// use fixed width instead +var xyzFormat = createFormat({decimals:4, trim:false}); +var integerFormat = createFormat({decimals:0}); + +// fixed settings +var thickness = 0; +var arcCounter = 0; +var lineCounter = -1; + +// collected state +var useVersion6 = false; +var arcFinish = undefined; +var feedActive = false; +var prevCoords = undefined; + +// override radius compensation +var compensationOffset = 0; // center compensation + +var etchOperation = false; // though-cut unless set to true +var forceOutput = false; + +/** + * + * @param num + * @returns Little Endian hex string (float) + */ + function ToHex(num) { + if (num == 0) { + return "00000000"; //bypass + } + + var sign = "0"; + + if(num < 0.0) { + sign = "1"; + num = -num; + } + + var mantissa = parseFloat(num).toString(2); + var exponent = 0; + + if (mantissa.indexOf('.') == -1) { + mantissa = mantissa.toString() + ".0"; + } + + if (mantissa.substr(0, 1) === "0") { + exponent = mantissa.indexOf('.') - mantissa.indexOf('1') + 127; + } + else { + exponent = mantissa.indexOf('.') - 1 + 127; + } + + mantissa = mantissa.replace(".", ""); + mantissa = mantissa.substr(mantissa.indexOf('1') + 1); + + if (mantissa.length > 23) { + mantissa = mantissa.substr(0, 23); + } + else { + while (mantissa.length < 23) { + mantissa = mantissa + "0"; + } + } + + var exp = parseFloat(exponent).toString(2); + + while(exp.length < 8) { + exp = "0" + exp; + } + + var numberFull = sign + exp + mantissa; + log("hellow world"); + // var hex = parseInt(numberFull, 2).toString(16).split(''); + // return (hex[6] + hex[7]) + (hex[4] + hex[5]) + (hex[2] + hex[3]) + (hex[0] + hex[1]); + return parseInt(numberFull, 2).toString(16); +} + +/** + * (IN PROGRESS) Write machine config to .sta file + */ +function writeSta() { + try { + var file = new TextFile("C:\\Users\\" + getGlobalParameter("username") + "\\AppData\\Local\\Fusion 360 CAM\\nc\\" + programName + ".sta", true, "utf-8"); + var float = 9.94; + + // var data = BinaryFile.loadBinary("C:\\Users\\kpan8\\Downloads\\stazip\\ld6.sta"); + var hex = toHex(6.0); + // data = String.fromCharCode(hex[0] + hex[1]) + String.fromCharCode(hex[2] + hex[3]) + String.fromCharCode(hex[4] + hex[5]) + String.fromCharCode(hex[6] + hex[7]); + file.writeln(hex); + // BinaryFile.saveBinary("C:\\Users\\" + getGlobalParameter("username") + "\\AppData\\Local\\Fusion 360 CAM\\nc\\" + programName + "bin.sta", data) + + file.close(); + + } catch (e) { + error(localize("Failed to write sta file.")); + } + +} + +/** + Writes the specified block. +*/ +function writeBlock() { + writeWords(arguments); +} + +function formatComment(comment) { + return "// " + comment; +} + +function writeComment(text) { + if (!getProperty("debugMode")) return; + writeln(formatComment(text.substr(0, maximumLineLength - 2))); +} + +var FIELD = " "; + +/** Make sure fields are aligned. */ +function f(text) { + var length = text.length; + if (length > 10) { + return 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; + if (length > size) { + return text; + } + return FIELD.substr(0, size - length) + text; +} + +function onOpen() { + useVersion6 = getProperty("formatVersion") == "6"; + unit = IN; // only inch mode is supported + + redirectToBuffer(); // buffer the entire program to be able to count the linear and circular moves + setWordSeparator(""); + + { // stock - workpiece + var workpiece = getWorkpiece(); + var delta = Vector.diff(workpiece.upper, workpiece.lower); + if (delta.isNonZero()) { + // thickness = (workpiece.upper.z - workpiece.lower.z); + } + } + + if (getNumberOfSections() > 0) { + var firstSection = getSection(0); + + var remaining = firstSection.workPlane; + if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) { + error(localize("Tool orientation is not supported.")); + return; + } + setRotation(remaining); + + if (!useVersion6) { + var originZ = firstSection.getGlobalZRange().getMinimum(); // the cutting depth of the first section + + for (var i = 0; i < getNumberOfSections(); ++i) { + var section = getSection(i); + var z = section.getGlobalZRange().getMinimum(); // contour Z of the each section + if (xyzFormat.getResultingValue(z) != xyzFormat.getResultingValue(originZ)) { + error(localize("You are trying to machine at multiple depths which is not allowed.")); + return; + } + } + } + } + forceOutput = true;// force out first line +} + +function onSection() { + var remaining = currentSection.workPlane; + if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) { + error(localize("Tool orientation is not supported.")); + return; + } + setRotation(remaining); + + etchOperation = false; + if (currentSection.getType() == TYPE_JET) { + switch (tool.type) { + case TOOL_WATER_JET: + break; + default: + error(localize("The CNC does not support the required tool.")); + return; + } + switch (currentSection.jetMode) { + case JET_MODE_THROUGH: + break; + case JET_MODE_ETCHING: + etchOperation = true; + break; + case JET_MODE_VAPORIZE: + error(localize("Vaporize is not supported by the CNC.")); + return; + default: + error(localize("Unsupported cutting mode.")); + return; + } + } else if (currentSection.getType() == TYPE_MILLING) { + warning(localize("Milling toolpath will be used as waterjet through-cutting toolpath.")); + } else { + error(localize("CNC doesn't support the toolpath.")); + return; + } + + var initialPosition = getFramePosition(currentSection.getInitialPosition()); + onExpandedRapid(initialPosition.x, initialPosition.y, initialPosition.z); +} + +function onParameter(name, value) { +} + +function writeLinear(x, y, z, feed, column7) { + var flag = false; + if (useVersion6) { + flag = xyzFormat.areDifferent(x, getCurrentPosition().x) || + xyzFormat.areDifferent(y, getCurrentPosition().y) || + xyzFormat.areDifferent(z, getCurrentPosition().z); + } else { + flag = xyzFormat.areDifferent(x, getCurrentPosition().x) || + xyzFormat.areDifferent(y, getCurrentPosition().y); + } + + 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; + } + if (getProperty("debugMode")){ + 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)), ",", + f(xyzFormat.format(z)), ",", + fi(integerFormat.format(0), 2), ",", // linear + fi(integerFormat.format(feed), 5), ",", + fi(integerFormat.format(compensationOffset), 2), ",", // left, center, right + 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( + f(xyzFormat.format(x)), ",", + f(xyzFormat.format(y)), ",", + fi(integerFormat.format(0), 2), ",", + fi(integerFormat.format(feed), 5), ",", + fi(integerFormat.format(compensationOffset), 2) + ); + } + ++lineCounter; + forceOutput = false; + } + if (feed > 0) { + feedActive = true; + } + prevCoords = {x:x, y:y, z:z}; +} + +function finishArcs() { + if (arcFinish) { + // complete circular motion with output of destination values + forceOutput = true; + writeLinear(arcFinish.x, arcFinish.y, arcFinish.z, arcFinish.feed, 2); + arcFinish = undefined; + } +} + +function onRapid(x, y, z) { + finishArcs(); + if (feedActive) { + forceOutput = true; + writeLinear(prevCoords.x, prevCoords.y, prevCoords.z, 0, 0); + } + writeLinear(x, y, z, 0, 0); // non-cutting + feedActive = false; +} + +function onLinear(x, y, z, feed) { + finishArcs(); + // skip output if next move is an arc. OnCircular record has this move destination XY + if (getNextRecord().getType() != RECORD_CIRCULAR) { + writeLinear(x, y, z, power ? getFeedInPercent(feed) : 0, 2); + } +} + +function onPower(power) { +} + +function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { + // spirals are not allowed - arcs must be < 360deg + // fail if radius compensation is changed for circular move + + // syntax is; start X, start y, arc direction, feed, comp, cx, cy + // end X, end Y, if following move is an arc, is the start x, start y, of the line + // end X, end Y, if following move is a line, is output in OnLinear + // using the arcFinish flag + + circularICode = (clockwise ? 1 : -1); + + if ((getCircularPlane() != PLANE_XY) || isHelical()) { + linearize(tolerance); + } + var p = getCurrentPosition(); + if (useVersion6) { + writeComment("Circular"); + if (getProperty("debugMode")){ + writeBlock( + commentf("X"), ",", + f("Y"), ",", + f("Z"), ",", + fi("CW", 2), ",", + fi("Feed", 5), ",", + fi("C", 2), ",", + fi("?", 2), ",", + f("CX"), ",", + f("CY"), ",", + f("CZ")); + } + writeBlock( + f(xyzFormat.format(p.x)), ",", + f(xyzFormat.format(p.y)), ",", + f(xyzFormat.format(p.z)), ",", + fi(integerFormat.format(circularICode), 2), ",", // arc cw/ccw + fi(integerFormat.format(power ? getFeedInPercent(feed) : 0), 5), ",", + fi(integerFormat.format(compensationOffset), 2), ",", // left, center, right + fi(integerFormat.format(2), 2), ",", // TAG: seen -2..2 - unknown + f(xyzFormat.format(cx)), ",", + f(xyzFormat.format(cy)), ",", + f(xyzFormat.format(0)) // PLANE_XY only + ); + } else { + writeComment("Circular"); + writeBlock( + f(xyzFormat.format(p.x)), ",", + f(xyzFormat.format(p.y)), ",", + fi(integerFormat.format(circularICode), 2), ",", // arc cw/ccw + fi(integerFormat.format(power ? getFeedInPercent(feed) : 0), 5), ",", + fi(integerFormat.format(compensationOffset), 2), ",", // left, center, right + f(xyzFormat.format(cx)), ",", + f(xyzFormat.format(cy)) + ); + } + ++arcCounter; + + // save destination values to complete arc move + arcFinish = {x:x, y:y, z:z, feed:(power ? getFeedInPercent(feed) : 0)}; + if (feed > 0) { + feedActive = true; + } + prevCoords = {x:x, y:y, z:z}; +} + +function getFeedInPercent(feed) { + var feedPercent; + if ((getProperty("maximumFeedrateIPM") > 0) && getProperty("useHSMFeedrates")) { + // use HSM feedrates + // 1 - 99 % + feedPercent = Math.min(Math.ceil(Math.min(getProperty("maximumFeedrateIPM"), feed) / getProperty("maximumFeedrateIPM") * 100), 99); + } else { + // use fixed feedrates per quality selection + switch (currentSection.quality) { + case 1: + // high quality + feedPercent = 20; // very slow, cut surface excellent + break; + case 2: + feedPercent = 40; // slow, cut surface good + break; + case 3: + feedPercent = 100; // fast, cut surface slightly rough + break; + default: + // medium quality + feedPercent = 60; // moderate, cut surface moderate + } + } + return feedPercent; +} + +function onRadiusCompensation() { + switch (radiusCompensation) { + case RADIUS_COMPENSATION_LEFT: + compensationOffset = -1; + break; + case RADIUS_COMPENSATION_RIGHT: + compensationOffset = 1; + break; + default: + compensationOffset = 0; // center compensation + } +} + +function onCycle() { + error(localize("Canned cycles are not supported.")); +} + +function onSectionEnd() { + finishArcs(); + compensationOffset = 0; // center compensation +} + +function onClose() { + writeSta(); + if (isRedirecting()) { + var mainProgram = getRedirectionBuffer(); // TAG: no need for redirection + closeRedirection(); + 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("// 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"); + if (programComment) { + writeln("// " + programComment); + } + write(mainProgram); + } +} + +function setProperty(property, value) { + properties[property].current = value; +} From 63efe812665026f4d852d7bf5b0f8adbfe80593f Mon Sep 17 00:00:00 2001 From: "Williams, Gavin J" Date: Thu, 23 Sep 2021 14:19:19 -0400 Subject: [PATCH 17/17] Closed Issue #31 --- Haas_Gantry_BIDC/Bechtel SR.cps | 15 +++++++++++---- Haas_Mills_BIDC/Bechtel DT.cps | 7 +++++-- Haas_Mills_BIDC/Bechtel VF2.cps | 5 ++++- Haas_Mills_BIDC/Bechtel VF4.cps | 5 ++++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Haas_Gantry_BIDC/Bechtel SR.cps b/Haas_Gantry_BIDC/Bechtel SR.cps index e0ef7a6..594ed56 100644 --- a/Haas_Gantry_BIDC/Bechtel SR.cps +++ b/Haas_Gantry_BIDC/Bechtel SR.cps @@ -868,10 +868,10 @@ function onOpen() { var tool = tools.getTool(i); // Added 8/31/21 | Kevin Pan | pan261 if (tool.number == 1) { - // throw "Tool number 1 is reserved for probing." + throw "Tool number 1 is reserved for probing." } if (tool.number == 2) { - // throw "Tool number 2 is not available for use." + throw "Tool number 2 is not available for use." } // pan261 @@ -1851,13 +1851,20 @@ function onSection() { } } - if (!isFirstSection()) { + if (!isFirstSection() && getProperty("toolHeightValidation")) { writeBlock(mFormat.format(0)); writeComment("CHECK TOOL AND PART"); if (!retracted) { writeRetract(Z); } writeRetract(X, Y); + } else if(!isFirstSection()) { + writeBlock(mFormat.format(1)); + writeComment("CHECK TOOL AND PART"); + if (!retracted) { + writeRetract(Z); + } + writeRetract(X, Y); } if (hasParameter("operation-comment")) { @@ -1874,7 +1881,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) { diff --git a/Haas_Mills_BIDC/Bechtel DT.cps b/Haas_Mills_BIDC/Bechtel DT.cps index c618ce4..73a80f4 100644 --- a/Haas_Mills_BIDC/Bechtel DT.cps +++ b/Haas_Mills_BIDC/Bechtel DT.cps @@ -2411,12 +2411,15 @@ function onSection() { } } - if (!isFirstSection()) { + if (!isFirstSection() && getProperty("toolLengthValidation")) { displayMedia("checkPartTool.jpg", false); writeBlock(mFormat.format(0)); writeBlock(mFormat.format(131)); + } else if (!isFirstSection()) { + writeBlock(mFormat.format(1)); + writeComment("Check Part and Tool"); } - + if (hasParameter("operation-comment")) { var comment = getParameter("operation-comment"); if (comment && ((comment !== lastOperationComment) || !patternIsActive || insertToolCall)) { diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index 091fbfc..2ebfa1b 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -2411,10 +2411,13 @@ function onSection() { } } - if (!isFirstSection()) { + if (!isFirstSection() && getProperty("toolLengthValidation")) { displayMedia("checkPartTool.jpg", false); writeBlock(mFormat.format(0)); writeBlock(mFormat.format(131)); + } else if (!isFirstSection()) { + writeBlock(mFormat.format(1)); + writeComment("Check Part and Tool"); } if (hasParameter("operation-comment")) { diff --git a/Haas_Mills_BIDC/Bechtel VF4.cps b/Haas_Mills_BIDC/Bechtel VF4.cps index 359bc34..d18bd54 100644 --- a/Haas_Mills_BIDC/Bechtel VF4.cps +++ b/Haas_Mills_BIDC/Bechtel VF4.cps @@ -2415,10 +2415,13 @@ function onSection() { } } - if (!isFirstSection()) { + if (!isFirstSection() && getProperty("toolLengthValidation")) { displayMedia("checkPartTool.jpg", false); writeBlock(mFormat.format(0)); writeBlock(mFormat.format(131)); + } else if (!isFirstSection()) { + writeBlock(mFormat.format(1)); + writeComment("Check Part and Tool"); } if (hasParameter("operation-comment")) {