From f3bf1c7e8f21c4d99bb378773ac92bf4a00851da Mon Sep 17 00:00:00 2001 From: will1742 Date: Thu, 24 Jun 2021 16:52:17 -0400 Subject: [PATCH 01/15] Shell Mill Probing Granularity --- Haas_Next_Generation/haas vf2.cps | 36 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 65f8421..e5edf9b 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -8,6 +8,9 @@ $Date: 2021-06-01 08:35:38 $ FORKID {DBD402DA-DE90-4634-A6A3-0AE5CC97DEC7} + + Modified by BIDC of Purdue University + Authors: Gavin Williams (will1742@purdue.edu) */ // >>>>> INCLUDED FROM ../../../haas next generation.cps @@ -667,23 +670,43 @@ function getHaasToolType(toolType) { } } -function getHaasProbingType(toolType, use9023) { - switch (getHaasToolType(toolType)) { + +// 06/24/21 | Gavin Williams | will1742 +// 002 Improved Probing +// Added case for shell mills +// Added improved 9023 compatibility +function getHaasProbingType(tool, use9023) { + var probeType; + switch (getHaasToolType(tool.type)) { case 3: + probeType = ((tool.taperAngle > 0) ? 1 : 3); + break; case 4: - return (use9023 ? 23 : 1); // rotate + probeType = 1; // rotate + break; case 1: case 2: case 5: case 6: case 7: - return (use9023 ? 12 : 2); // non rotate + probeType = 2; // non rotate + break; case 0: - return (use9023 ? 13 : 3); // rotate length and dia + probeType = 3; // rotate length and dia + break; default: error(localize("Invalid HAAS tool type.")); return -1; } + + if (use9023) { + if (probeType == 2 || probeType == 3){ + return probeType + 10; + } + return 23; + } + + return probeType; } function writeToolCycleBlock(tool) { @@ -732,7 +755,7 @@ function writeToolMeasureBlock(tool, preMeasure) { "P9995", "A0.", "B" + getHaasToolType(tool.type) + ".", - "C" + getHaasProbingType(tool.type, false) + ".", + "C" + getHaasProbingType(tool, false) + ".", "T" + toolFormat.format(tool.number), "E" + xyzFormat.format(tool.bodyLength + tool.holderLength), "D" + xyzFormat.format(tool.diameter), @@ -1150,6 +1173,7 @@ function onOpen() { writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool writeBlock(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool writeToolMeasureBlock(tool, true); + // TODO WHATISBOOL } else { writeToolCycleBlock(tool); } From 3eb266fc577b2165c7101c55af28f4c05a8ec170 Mon Sep 17 00:00:00 2001 From: will1742 Date: Fri, 25 Jun 2021 09:36:09 -0400 Subject: [PATCH 02/15] Shell Mill Probing Granularity --- Haas_Next_Generation/haas vf2.cps | 36 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 65f8421..e5edf9b 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -8,6 +8,9 @@ $Date: 2021-06-01 08:35:38 $ FORKID {DBD402DA-DE90-4634-A6A3-0AE5CC97DEC7} + + Modified by BIDC of Purdue University + Authors: Gavin Williams (will1742@purdue.edu) */ // >>>>> INCLUDED FROM ../../../haas next generation.cps @@ -667,23 +670,43 @@ function getHaasToolType(toolType) { } } -function getHaasProbingType(toolType, use9023) { - switch (getHaasToolType(toolType)) { + +// 06/24/21 | Gavin Williams | will1742 +// 002 Improved Probing +// Added case for shell mills +// Added improved 9023 compatibility +function getHaasProbingType(tool, use9023) { + var probeType; + switch (getHaasToolType(tool.type)) { case 3: + probeType = ((tool.taperAngle > 0) ? 1 : 3); + break; case 4: - return (use9023 ? 23 : 1); // rotate + probeType = 1; // rotate + break; case 1: case 2: case 5: case 6: case 7: - return (use9023 ? 12 : 2); // non rotate + probeType = 2; // non rotate + break; case 0: - return (use9023 ? 13 : 3); // rotate length and dia + probeType = 3; // rotate length and dia + break; default: error(localize("Invalid HAAS tool type.")); return -1; } + + if (use9023) { + if (probeType == 2 || probeType == 3){ + return probeType + 10; + } + return 23; + } + + return probeType; } function writeToolCycleBlock(tool) { @@ -732,7 +755,7 @@ function writeToolMeasureBlock(tool, preMeasure) { "P9995", "A0.", "B" + getHaasToolType(tool.type) + ".", - "C" + getHaasProbingType(tool.type, false) + ".", + "C" + getHaasProbingType(tool, false) + ".", "T" + toolFormat.format(tool.number), "E" + xyzFormat.format(tool.bodyLength + tool.holderLength), "D" + xyzFormat.format(tool.diameter), @@ -1150,6 +1173,7 @@ function onOpen() { writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool writeBlock(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool writeToolMeasureBlock(tool, true); + // TODO WHATISBOOL } else { writeToolCycleBlock(tool); } From f2dab7600c01c206362eb6d5625be998a5eb1bc9 Mon Sep 17 00:00:00 2001 From: will1742 Date: Fri, 25 Jun 2021 13:02:01 -0400 Subject: [PATCH 03/15] Added Radius Case --- Haas_Next_Generation/haas vf2.cps | 1 + 1 file changed, 1 insertion(+) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index e5edf9b..1af0ac8 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -661,6 +661,7 @@ function getHaasToolType(toolType) { return 5; // center drill case TOOL_MILLING_END_BALL: case TOOL_MILLING_LOLLIPOP: + case TOOL_MILLING_RADIUS: return 6; // ball nose case TOOL_PROBE: return 7; // probe From 65bfee78e3b51d26a9398a2e285265d44ad239c1 Mon Sep 17 00:00:00 2001 From: will1742 Date: Fri, 25 Jun 2021 13:11:28 -0400 Subject: [PATCH 04/15] new tool type and probing type functions --- Haas_Next_Generation/haas vf2.cps | 64 ++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 1af0ac8..5b4f7e4 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -661,7 +661,6 @@ function getHaasToolType(toolType) { return 5; // center drill case TOOL_MILLING_END_BALL: case TOOL_MILLING_LOLLIPOP: - case TOOL_MILLING_RADIUS: return 6; // ball nose case TOOL_PROBE: return 7; // probe @@ -671,11 +670,11 @@ function getHaasToolType(toolType) { } } - // 06/24/21 | Gavin Williams | will1742 // 002 Improved Probing // Added case for shell mills // Added improved 9023 compatibility +/* function getHaasProbingType(tool, use9023) { var probeType; switch (getHaasToolType(tool.type)) { @@ -708,6 +707,67 @@ function getHaasProbingType(tool, use9023) { } return probeType; +};*/ + +function getHaasProbingType(toolType, use9023) { + switch (getHaasToolType(toolType)) { + case 3: + case 4: + return (use9023 ? 23 : 1); // rotate + case 1: + case 2: + case 5: + case 6: + case 7: + return (use9023 ? 12 : 2); // non rotate + case 0: + return (use9023 ? 13 : 3); // rotate length and dia + default: + error(localize("Invalid HAAS tool type.")); + return -1; + } +} + +function getHaasToolTypeBIDC(toolType) { + switch (toolType) { + case TOOL_DRILL: + case TOOL_REAMER: + return 1; // drill + case TOOL_TAP_RIGHT_HAND: + case TOOL_TAP_LEFT_HAND: + return 2; // tap + case TOOL_MILLING_FACE: + case TOOL_MILLING_SLOT: + case TOOL_BORING_BAR: + return 3; // shell mill + case TOOL_MILLING_END_FLAT: + case TOOL_MILLING_END_BULLNOSE: + case TOOL_MILLING_TAPERED: + case TOOL_MILLING_DOVETAIL: + return 4; // end mill + case TOOL_DRILL_SPOT: + case TOOL_MILLING_CHAMFER: + case TOOL_DRILL_CENTER: + case TOOL_COUNTER_SINK: + case TOOL_COUNTER_BORE: + case TOOL_MILLING_THREAD: + case TOOL_MILLING_FORM: + return 5; // center drill + case TOOL_MILLING_END_BALL: + case TOOL_MILLING_LOLLIPOP: + case TOOL_MILLING_RADIUS: + return 6; // ball nose + case TOOL_PROBE: + return 7; // probe + default: + error(localize("Invalid HAAS tool type.")); + return -1; + } +} + +function getHaasProbingTypeBIDC(toolType) { + //TODO + return -1; } function writeToolCycleBlock(tool) { From 16e88e97010a9d10b79aead6e3f7a71789b76b11 Mon Sep 17 00:00:00 2001 From: will1742 Date: Fri, 25 Jun 2021 16:56:50 -0400 Subject: [PATCH 05/15] Added new ProbingType function --- Haas_Next_Generation/haas vf2.cps | 106 ++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 14 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 5b4f7e4..097d4bf 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -444,6 +444,22 @@ staticProperties = { singleResultsFile: true }; + const HAAS_DRILL = 1; + const HAAS_TAP = 2; + const HAAS_SHELL = 3; + const HAAS_END_MILL = 4; + const HAAS_CENTER = 5; + const HAAS_BALL_NOSE = 6; + const HAAS_PROBE = 7; + + const NO_PROBING = 0; + const LEN_ROT = 1; + const LEN_NON_ROT = 2; + const LEN_DIA_ROT = 3; + + const DEFAULT_HAAS_K_FACTOR = 0.05; + const NULL_HAAS_K_FACTOR = 0; + 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} @@ -634,6 +650,8 @@ function writeComment(text) { /** Returns the matching HAAS tool type for the tool. */ + +// TODO FIX TOOL TYPE function getHaasToolType(toolType) { switch (toolType) { case TOOL_DRILL: @@ -710,7 +728,7 @@ function getHaasProbingType(tool, use9023) { };*/ function getHaasProbingType(toolType, use9023) { - switch (getHaasToolType(toolType)) { + switch (getHaasToolType(toolType.type)) { case 3: case 4: return (use9023 ? 23 : 1); // rotate @@ -732,19 +750,19 @@ function getHaasToolTypeBIDC(toolType) { switch (toolType) { case TOOL_DRILL: case TOOL_REAMER: - return 1; // drill + return HAAS_DRILL; // drill case TOOL_TAP_RIGHT_HAND: case TOOL_TAP_LEFT_HAND: - return 2; // tap + return HAAS_TAP; // tap case TOOL_MILLING_FACE: case TOOL_MILLING_SLOT: case TOOL_BORING_BAR: - return 3; // shell mill + return HAAS_SHELL; // shell mill case TOOL_MILLING_END_FLAT: case TOOL_MILLING_END_BULLNOSE: case TOOL_MILLING_TAPERED: case TOOL_MILLING_DOVETAIL: - return 4; // end mill + return HAAS_END_MILL; // end mill case TOOL_DRILL_SPOT: case TOOL_MILLING_CHAMFER: case TOOL_DRILL_CENTER: @@ -752,22 +770,82 @@ function getHaasToolTypeBIDC(toolType) { case TOOL_COUNTER_BORE: case TOOL_MILLING_THREAD: case TOOL_MILLING_FORM: - return 5; // center drill + return HAAS_CENTER; // center drill case TOOL_MILLING_END_BALL: case TOOL_MILLING_LOLLIPOP: case TOOL_MILLING_RADIUS: - return 6; // ball nose + return HAAS_BALL_NOSE; // ball nose case TOOL_PROBE: - return 7; // probe + return HAAS_PROBE; // probe default: error(localize("Invalid HAAS tool type.")); return -1; } } -function getHaasProbingTypeBIDC(toolType) { - //TODO - return -1; +// 06/25/21 | Gavin Williams | will1742 +// 002 Probing +function formatCNumber(probeType, use9023){ + if (use9023) { + if (probeType == LEN_NON_ROT || probeType == LEN_DIA_ROT){ + return probeType + 10; + } + return 23; + } + return probeType; +} + +function getHaasProbingTypeBIDC(tool, use9023) { + switch (getHaasToolTypeBIDC(tool.type)) { + case HAAS_PROBE: + return formatCNumber(NO_PROBING, use9023); + case HAAS_TAP: + case HAAS_DRILL: + return formatCNumber(LEN_NON_ROT, use9023); + case HAAS_CENTER: + if (tool.type == TOOL_MILLING_THREAD) { + return formatCNumber(LEN_DIA_ROT, use9023); + } + if (tool.type == TOOL_MILLING_FORM) { + return formatCNumber(NO_PROBING, use9023); + } + formatCNumber(LEN_NON_ROT, use9023); + case HAAS_END_MILL: + return formatCNumber((tool.type == TOOL_MILLING_TAPERED ? LEN_ROT : LEN_DIA_ROT), use9023); + case HAAS_BALL_NOSE: + return formatCNumber((tool.type == TOOL_MILLING_RADIUS ? LEN_ROT : LEN_DIA_ROT), use9023); + case HAAS_SHELL: + if ((tool.type == TOOL_MILLING_FACE) && (tool.taperAngle !=0)) { + return formatCNumber(LEN_ROT, use9023); + } + return formatCNumber(LEN_DIA_ROT, use9023); + default: + return -1; + } +} + +function getHaasKFactorBIDC(tool) { + switch (getHaasToolTypeBIDC(tool.type)) { + case HAAS_SHELL: + case HAAS_END_MILL: + // TODO: Add cases + return DEFAULT_HAAS_K_FACTOR; + case HAAS_BALL_NOSE: + if (tool.type == TOOL_MILLING_RADIUS) { + return NULL_HAAS_K_FACTOR; + } + return tool.diameter + DEFAULT_HAAS_K_FACTOR; + case HAAS_CENTER: + case HAAS_PROBE: + case HAAS_DRILL: + case HAAS_TAP: + if (tool.type == TOOL_MILLING_THREAD) { + return tool.getThreadPitch() + DEFAULT_HAAS_K_FACTOR; + } + return NULL_HAAS_K_FACTOR; + default: + return -1; + } } function writeToolCycleBlock(tool) { @@ -815,12 +893,12 @@ function writeToolMeasureBlock(tool, preMeasure) { gFormat.format(65), "P9995", "A0.", - "B" + getHaasToolType(tool.type) + ".", - "C" + getHaasProbingType(tool, false) + ".", + "B" + getHaasToolTypeBIDC(tool.type) + ".", + "C" + getHaasProbingTypeBIDC(tool, false) + ".", "T" + toolFormat.format(tool.number), "E" + xyzFormat.format(tool.bodyLength + tool.holderLength), "D" + xyzFormat.format(tool.diameter), - "K" + xyzFormat.format(0.1), + "K" + xyzFormat.format(getHaasKFactorBIDC(tool)), "I0.", comment ); // probe tool From cd03fee84032071d09aba74970653bb42aa9b2ca Mon Sep 17 00:00:00 2001 From: will1742 Date: Mon, 28 Jun 2021 10:24:38 -0400 Subject: [PATCH 06/15] Added cases for K Factor --- Haas_Next_Generation/haas vf2.cps | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 097d4bf..d2eadbd 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -809,7 +809,7 @@ function getHaasProbingTypeBIDC(tool, use9023) { if (tool.type == TOOL_MILLING_FORM) { return formatCNumber(NO_PROBING, use9023); } - formatCNumber(LEN_NON_ROT, use9023); + return formatCNumber(LEN_NON_ROT, use9023); case HAAS_END_MILL: return formatCNumber((tool.type == TOOL_MILLING_TAPERED ? LEN_ROT : LEN_DIA_ROT), use9023); case HAAS_BALL_NOSE: @@ -828,19 +828,24 @@ function getHaasKFactorBIDC(tool) { switch (getHaasToolTypeBIDC(tool.type)) { case HAAS_SHELL: case HAAS_END_MILL: - // TODO: Add cases - return DEFAULT_HAAS_K_FACTOR; + if (tool.type == TOOL_BORING_BAR || tool.type == TOOL_MILLING_END_FLAT) { + return DEFAULT_HAAS_K_FACTOR; + } + if (tool.type == TOOL_MILLING_FACE && tool.taperAngle != 0) { + return NULL_HAAS_K_FACTOR; + } + return DEFAULT_HAAS_K_FACTOR + tool.cornerRadius; case HAAS_BALL_NOSE: if (tool.type == TOOL_MILLING_RADIUS) { return NULL_HAAS_K_FACTOR; } - return tool.diameter + DEFAULT_HAAS_K_FACTOR; + return DEFAULT_HAAS_K_FACTOR + tool.diameter; case HAAS_CENTER: case HAAS_PROBE: case HAAS_DRILL: case HAAS_TAP: if (tool.type == TOOL_MILLING_THREAD) { - return tool.getThreadPitch() + DEFAULT_HAAS_K_FACTOR; + return DEFAULT_HAAS_K_FACTOR + tool.getThreadPitch(); } return NULL_HAAS_K_FACTOR; default: From fbf1b39985d1b5e80788a5f4e92617b2f5e7c88e Mon Sep 17 00:00:00 2001 From: will1742 Date: Mon, 28 Jun 2021 13:45:03 -0400 Subject: [PATCH 07/15] Using radius for K case --- Haas_Next_Generation/README.txt | 1 + Haas_Next_Generation/haas vf2.cps | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Haas_Next_Generation/README.txt b/Haas_Next_Generation/README.txt index da050fb..8e31c78 100644 --- a/Haas_Next_Generation/README.txt +++ b/Haas_Next_Generation/README.txt @@ -3,6 +3,7 @@ Changelog 06/14/21 Added media and QA 06/15/21 Check tool distance from stock, finalized QA 06/21/21 Tool probing required, tool probing now uses P9995 +06/28/21 Tool specific probing added, with cases for type of probing and k factor Function List: diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index d2eadbd..db75ad2 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -839,7 +839,7 @@ function getHaasKFactorBIDC(tool) { if (tool.type == TOOL_MILLING_RADIUS) { return NULL_HAAS_K_FACTOR; } - return DEFAULT_HAAS_K_FACTOR + tool.diameter; + return DEFAULT_HAAS_K_FACTOR + (tool.diameter/2); case HAAS_CENTER: case HAAS_PROBE: case HAAS_DRILL: @@ -877,7 +877,6 @@ function writeToolMeasureBlock(tool, preMeasure) { // var writeFunction = measureTool ? writeBlock : writeOptionalBlock; var writeFunction = writeBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; - if (!preMeasure) { prepareForToolCheck(); } From 9fa2a50b7de5000f8e0115937878f985030b5101 Mon Sep 17 00:00:00 2001 From: "Williams, Gavin J" Date: Mon, 28 Jun 2021 16:10:11 -0400 Subject: [PATCH 08/15] Altered Thread Mill Classification --- Haas_Next_Generation/haas vf2.cps | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index db75ad2..77a0ef0 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -762,13 +762,13 @@ function getHaasToolTypeBIDC(toolType) { case TOOL_MILLING_END_BULLNOSE: case TOOL_MILLING_TAPERED: case TOOL_MILLING_DOVETAIL: + case TOOL_MILLING_THREAD: return HAAS_END_MILL; // end mill case TOOL_DRILL_SPOT: case TOOL_MILLING_CHAMFER: case TOOL_DRILL_CENTER: case TOOL_COUNTER_SINK: case TOOL_COUNTER_BORE: - case TOOL_MILLING_THREAD: case TOOL_MILLING_FORM: return HAAS_CENTER; // center drill case TOOL_MILLING_END_BALL: @@ -803,9 +803,6 @@ function getHaasProbingTypeBIDC(tool, use9023) { case HAAS_DRILL: return formatCNumber(LEN_NON_ROT, use9023); case HAAS_CENTER: - if (tool.type == TOOL_MILLING_THREAD) { - return formatCNumber(LEN_DIA_ROT, use9023); - } if (tool.type == TOOL_MILLING_FORM) { return formatCNumber(NO_PROBING, use9023); } @@ -834,6 +831,9 @@ function getHaasKFactorBIDC(tool) { if (tool.type == TOOL_MILLING_FACE && tool.taperAngle != 0) { return NULL_HAAS_K_FACTOR; } + if (tool.type == TOOL_MILLING_THREAD) { + return DEFAULT_HAAS_K_FACTOR + tool.getThreadPitch(); + } return DEFAULT_HAAS_K_FACTOR + tool.cornerRadius; case HAAS_BALL_NOSE: if (tool.type == TOOL_MILLING_RADIUS) { @@ -844,9 +844,7 @@ function getHaasKFactorBIDC(tool) { case HAAS_PROBE: case HAAS_DRILL: case HAAS_TAP: - if (tool.type == TOOL_MILLING_THREAD) { - return DEFAULT_HAAS_K_FACTOR + tool.getThreadPitch(); - } + return NULL_HAAS_K_FACTOR; default: return -1; @@ -893,6 +891,7 @@ function writeToolMeasureBlock(tool, preMeasure) { ); } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool + // TODO: fix tool type writeFunction( gFormat.format(65), "P9995", @@ -1312,6 +1311,7 @@ function onOpen() { } comment += " - " + getToolTypeName(tool.type); writeComment(comment); + writeComment(tool.description); if (staticProperties.measureToolsAtStart) { writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool writeBlock(mFormat.format(0), formatComment("Load Tool")); //Pause until operator loads tool From f4e956c40a5ffb8d0928272de5159edc92bc659b Mon Sep 17 00:00:00 2001 From: will1742 Date: Mon, 28 Jun 2021 16:43:49 -0400 Subject: [PATCH 09/15] Set number of flutes per tool --- Haas_Next_Generation/README.txt | 5 +++++ Haas_Next_Generation/haas vf2.cps | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/Haas_Next_Generation/README.txt b/Haas_Next_Generation/README.txt index 8e31c78..6ac065f 100644 --- a/Haas_Next_Generation/README.txt +++ b/Haas_Next_Generation/README.txt @@ -26,6 +26,10 @@ takeInput(prompt, options) any number of options can be input, sequenceNumbers will be adjusted to compensate +setMacro(macro, value, comment) + sets specified macro, adds inline comment + + General notes: - staticProperties is a dictionary containing all properties previously allowed to be altered by the user. @@ -33,3 +37,4 @@ General notes: - Some optional portions were commented out, specifically those associated with safe start. +- Macro references can be found on page 189 of the milling manual \ No newline at end of file diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 77a0ef0..74219d0 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -892,6 +892,7 @@ function writeToolMeasureBlock(tool, preMeasure) { } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool // TODO: fix tool type + setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes"); writeFunction( gFormat.format(65), "P9995", @@ -909,6 +910,13 @@ function writeToolMeasureBlock(tool, preMeasure) { measureTool = false; } +// 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 defineMachineModel() { var useTCPC = staticProperties.useTCPC; switch (staticProperties.machineModel) { From 30f4c415733db497ba29b5dd868a3436211f9038 Mon Sep 17 00:00:00 2001 From: will1742 Date: Tue, 6 Jul 2021 13:11:00 -0400 Subject: [PATCH 10/15] Added WCS verification --- Haas_Next_Generation/haas vf2.cps | 48 ++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 74219d0..6bf4ca8 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -414,7 +414,7 @@ staticProperties = { useDWO: true, safeStartAllOperations: true, preloadTool: true, - chipTransport: true, + chipTransport: false, optionalStop: true, separateWordsWithSpace: true, useRadius: false, @@ -441,7 +441,8 @@ staticProperties = { useM130PartImages: false, useM130ToolImages: false, coolantPressure: "", - singleResultsFile: true + singleResultsFile: true, + pencilWCSVerif: true }; const HAAS_DRILL = 1; @@ -1874,6 +1875,10 @@ function onManualNC(command, value) { var probeOutputWorkOffset = 1; var stockTopZ = -1; +var stockUpperX; +var stockLowerX; +var stockUpperY; +var stockLowerY; function onParameter(name, value) { if (name == "probe-output-work-offset") { @@ -1885,6 +1890,18 @@ function onParameter(name, value) { if (name == "stock-upper-z") { stockTopZ = value; } + if (name == "stock-upper-x") { + stockUpperX = value; + } + if (name == "stock-lower-x") { + stockLowerX = value; + } + if (name == "stock-upper-y") { + stockUpperY = value; + } + if (name == "stock-lower-y") { + stockLowerY = value; + } } var seenPatternIds = {}; @@ -2173,6 +2190,27 @@ function setAbsoluteMode(xyz, abc) { } function onSection() { + if (isFirstSection() && staticProperties.pencilWCSVerif) { + var stockMidX = (stockUpperX + stockLowerX)/2; + var stockMidY = (stockUpperY + stockLowerY)/2; + writeln(""); + writeComment("Verify WCS"); + writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool + writeBlock(gFormat.format(0), xOutput.format(stockMidX), yOutput.format(stockMidY)); + displayMedia("Net Share/Media/xyWCSCheck.png"); + writeBlock(mFormat.format(0), formatComment("Open door")); + displayMedia("Net Share/Media/arrowDown.png"); + var gotoRef = takeInput("Is the graphite probing device in the middle of the stock?", ['Y']); + 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("Net Share/Media/zWCSCheck.png"); + writeBlock(mFormat.format(0), formatComment("Open door")); + displayMedia("Net Share/Media/arrowDown.png"); + gotoRef = takeInput("Is the graphite probing device touching the stock?", ['Y']); + writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); + } + + var forceToolAndRetract = optionalSection && !currentSection.isOptional(); optionalSection = currentSection.isOptional(); @@ -2606,8 +2644,10 @@ function onSection() { writeComment("END VALIDATION SECTION"); // initialize spindle and engage coolant if heights are correct - writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); - setCoolant(tool.coolant); + if (tool.type != TOOL_PROBE) { + writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); + setCoolant(tool.coolant); + } // define subprogram subprogramDefine(initialPosition, abc, retracted, zIsOutput); From 87bb94383e4c190e68bbe37c97865e4ae269ad0c Mon Sep 17 00:00:00 2001 From: will1742 Date: Tue, 6 Jul 2021 16:52:18 -0400 Subject: [PATCH 11/15] Removed Deprecated Code --- Haas_Next_Generation/haas vf2.cps | 56 +++++-------------------------- 1 file changed, 9 insertions(+), 47 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 6bf4ca8..b478f7e 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -652,7 +652,6 @@ function writeComment(text) { Returns the matching HAAS tool type for the tool. */ -// TODO FIX TOOL TYPE function getHaasToolType(toolType) { switch (toolType) { case TOOL_DRILL: @@ -689,45 +688,6 @@ function getHaasToolType(toolType) { } } -// 06/24/21 | Gavin Williams | will1742 -// 002 Improved Probing -// Added case for shell mills -// Added improved 9023 compatibility -/* -function getHaasProbingType(tool, use9023) { - var probeType; - switch (getHaasToolType(tool.type)) { - case 3: - probeType = ((tool.taperAngle > 0) ? 1 : 3); - break; - case 4: - probeType = 1; // rotate - break; - case 1: - case 2: - case 5: - case 6: - case 7: - probeType = 2; // non rotate - break; - case 0: - probeType = 3; // rotate length and dia - break; - default: - error(localize("Invalid HAAS tool type.")); - return -1; - } - - if (use9023) { - if (probeType == 2 || probeType == 3){ - return probeType + 10; - } - return 23; - } - - return probeType; -};*/ - function getHaasProbingType(toolType, use9023) { switch (getHaasToolType(toolType.type)) { case 3: @@ -2190,18 +2150,24 @@ function setAbsoluteMode(xyz, abc) { } function onSection() { + // 07/06/21 | Gavin Williams | will1742 + // 002 Improved Probing + // uses pencil to verify WCS, prompts user if (isFirstSection() && staticProperties.pencilWCSVerif) { var stockMidX = (stockUpperX + stockLowerX)/2; var stockMidY = (stockUpperY + stockLowerY)/2; writeln(""); writeComment("Verify WCS"); writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool + writeBlock(gFormat.format(0), xOutput.format(stockMidX), yOutput.format(stockMidY)); displayMedia("Net Share/Media/xyWCSCheck.png"); writeBlock(mFormat.format(0), formatComment("Open door")); displayMedia("Net Share/Media/arrowDown.png"); var gotoRef = takeInput("Is the graphite probing device in the middle of the stock?", ['Y']); writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); + + // TODO fix work offset for pencil on Z approach writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); displayMedia("Net Share/Media/zWCSCheck.png"); writeBlock(mFormat.format(0), formatComment("Open door")); @@ -2307,11 +2273,6 @@ function onSection() { writeRetract(Z); } } - - // 6/18/21 | Gavin Williams | will1742 - // Terminate any media that may have been active at beginning of section - // Issue 001: Input and validation - writeBlock(mFormat.format(131), formatComment("End multimedia")); if (insertToolCall || operationNeedsSafeStart) { @@ -2676,7 +2637,7 @@ function takeInput(prompt, options) { if (macroNumber > 549) macroNumber = 500; // init macro var to 0 - writeWords("#" + macroNumber + "=0", formatComment("Initialize macro variable")); + setMacro(macroNumber, 0, "Initialize macro variable"); // disply prompt and save response writeBlock(mFormat.format(109), "P" + nFormat.format(macroNumber), formatComment(prompt)); @@ -2712,13 +2673,14 @@ function takeInput(prompt, options) { // Added 06/15/21 | Gavin Williamas | will1742 // Issue 001 Input and validation -// Halts program until TA arrives. Returns to beginning of onSection +// Halts program until TA arrives. Jumps to gotoRef function getTA(file, seqNum, gotoRef) { writeWords("N" + nFormat.format(seqNum), gFormat.format(53), gFormat.format(0), zOutput.format(0.), formatComment("Retract spindle")); writeWords(mFormat.format(130), formatComment(file)); writeWords(mFormat.format(0), formatComment("Halt Program")); + writeWords(mFormat.format(131)); writeWords("GOTO" + nFormat.format(gotoRef), formatComment("Return to beginning of operation")); } From 21d17f93ba9772d3694f8225f1fac24cd37799f9 Mon Sep 17 00:00:00 2001 From: "Williams, Gavin J" Date: Wed, 7 Jul 2021 16:52:39 -0400 Subject: [PATCH 12/15] Refactored to Reflect Updated NGC --- .gitignore | 2 ++ Haas_Next_Generation/haas vf2.cps | 44 +++++++++++++++---------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index e45abea..f94f965 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ Old/haas next generation.cps +*.nc +Haas_Next_Generation/haas next* \ No newline at end of file diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index b478f7e..fa150d9 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -406,9 +406,9 @@ properties = { staticProperties = { machineModel: "none", safePositionMethod: "G53", - hasAAxis: "false", + hasAAxis: "reversed", hasBAxis: "false", - hasCAxis: "false", + hasCAxis: "true", useDPMFeeds: false, useTCPC: true, useDWO: true, @@ -651,7 +651,6 @@ function writeComment(text) { /** Returns the matching HAAS tool type for the tool. */ - function getHaasToolType(toolType) { switch (toolType) { case TOOL_DRILL: @@ -852,7 +851,6 @@ function writeToolMeasureBlock(tool, preMeasure) { ); } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - // TODO: fix tool type setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes"); writeFunction( gFormat.format(65), @@ -967,7 +965,7 @@ function activateMachine() { } // retract/reconfigure - safeRetractDistance = staticProperties.singleResultsFile != undefined ? staticProperties.singleResultsFile : + safeRetractDistance = staticProperties.safeRetractDistance != undefined ? staticProperties.safeRetractDistance : (typeof safeRetractDistance == "number" ? safeRetractDistance : 0); if (machineConfiguration.performRewinds() || (typeof performRewinds == "undefined" ? false : performRewinds)) { machineConfiguration.enableMachineRewinds(); // enables the rewind/reconfigure logic @@ -991,11 +989,11 @@ function activateMachine() { var section = getSection(i); if (section.isMultiAxis()) { machineConfiguration.setToolLength(section.getTool().getBodyLength()); // define the tool length for head adjustments - section.optimizeMachineAnglesByMachine(machineConfiguration, OPTIMIZE_AXIS); + section.optimizeMachineAnglesByMachine(machineConfiguration, tcpIsSupported ? 0 : 1); } } } else { - optimizeMachineAngles2(OPTIMIZE_AXIS); + optimizeMachineAngles2(tcpIsSupported ? 0 : 1); } } @@ -1125,9 +1123,10 @@ function onOpen() { if (!staticProperties.separateWordsWithSpace) { setWordSeparator(""); } - saveshowSequenceNumbers = staticProperties.showSequenceNumbers; + saveShowSequenceNumbers = staticProperties.showSequenceNumbers; sequenceNumber = staticProperties.sequenceNumberStart; writeln("%"); + if (programName) { var programId; try { @@ -2046,7 +2045,7 @@ function subprogramEnd() { } forceAny(); firstPattern = false; - staticProperties.showSequenceNumbers = saveshowSequenceNumbers; + staticProperties.showSequenceNumbers = saveShowSequenceNumbers; closeRedirection(); } @@ -2484,10 +2483,9 @@ function onSection() { // writeComment("PREPOSITIONING END"); skipBlock = _skipBlock; writeBlock( - gMotionModal.format(G), - conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), - conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), - xOutput.format(initialPosition.x), yOutput.format(initialPosition.y), zOutput.format(initialPosition.z), F, + gMotionModal.format(0), // G0 motion mode is required for the G234 command + gFormat.format(234), + xOutput.format(initialPosition.x), yOutput.format(initialPosition.y), zOutput.format(initialPosition.z), hFormat.format(lengthOffset) ); } else { @@ -2506,7 +2504,7 @@ function onSection() { skipBlock = _skipBlock; writeBlock( gAbsIncModal.format(90), - gMotionModal.format(G), + gMotionModal.format(currentSection.isMultiAxis() && tcpIsSupported ? 0 : G), conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), xOutput.format(initialPosition.x), @@ -2529,7 +2527,9 @@ function onSection() { writeBlock(gAbsIncModal.format(90), gMotionModal.format(0), x, y); } } - + if (gMotionModal.getCurrent() == 0) { + forceFeed(); + } gMotionModal.reset(); } else { validate(lengthCompensationActive, "Length compensation is not active."); @@ -3524,7 +3524,6 @@ function onRadiusCompensation() { pendingRadiusCompensation = radiusCompensation; } -var forceG0 = false; function onRapid(_x, _y, _z) { var x = xOutput.format(_x); var y = yOutput.format(_y); @@ -3534,14 +3533,13 @@ function onRapid(_x, _y, _z) { error(localize("Radius compensation mode cannot be changed at rapid traversal.")); return; } - if (!staticProperties.useG0 && !forceG0 && (((x ? 1 : 0) + (y ? 1 : 0) + (z ? 1 : 0)) > 1)) { + if (!staticProperties.useG0 && (((x ? 1 : 0) + (y ? 1 : 0) + (z ? 1 : 0)) > 1)) { // axes are not synchronized writeBlock(gFeedModeModal.format(94), gMotionModal.format(1), x, y, z, getFeed(toPreciseUnit(highFeedrate, MM))); } else { writeBlock(gMotionModal.format(0), x, y, z); forceFeed(); } - forceG0 = false; } } @@ -3587,6 +3585,7 @@ function onLinear(_x, _y, _z, feed) { } } +var forceG0 = false; function onRapid5D(_x, _y, _z, _a, _b, _c) { if (!currentSection.isOptimizedForMachine()) { error(localize("This post configuration has not been customized for 5-axis simultaneous toolpath.")); @@ -3605,7 +3604,8 @@ function onRapid5D(_x, _y, _z, _a, _b, _c) { ((bOutput.isEnabled() && abcFormat.areDifferent(_b, bOutput.getCurrent())) ? 1 : 0) + ((cOutput.isEnabled() && abcFormat.areDifferent(_c, cOutput.getCurrent())) ? 1 : 0); if (!staticProperties.useG0 && !forceG0 && (tcpIsSupported || (num > 1))) { - invokeOnLinear5D(_x, _y, _z, _a, _b, _c, toPreciseUnit(highFeedrate, MM)); // onLinear5D handles inverse time feedrates + invokeOnLinear5D(_x, _y, _z, _a, _b, _c, highFeedrate); // onLinear5D handles inverse time feedrates + forceG0 = false; return; } @@ -3707,7 +3707,8 @@ function onRotateAxes(_x, _y, _z, _a, _b, _c) { function onReturnFromSafeRetractPosition(_x, _y, _z) { // reinstate TCP if (tcpIsSupported) { - writeBlock(gFormat.format(234), hFormat.format(tool.lengthOffset), formatComment("TCPC ON")); + writeBlock(gMotionModal.format(0), gFormat.format(234), hFormat.format(tool.lengthOffset), formatComment("TCPC ON")); + forceFeed(); lengthCompensationActive = true; } @@ -3716,7 +3717,6 @@ function onReturnFromSafeRetractPosition(_x, _y, _z) { xOutput.reset(); yOutput.reset(); zOutput.disable(); - forceG0 = true; invokeOnRapid(_x, _y, _z); // position in Z @@ -5045,7 +5045,7 @@ function forceSequenceNumbers(force) { if (force) { staticProperties.showSequenceNumbers = true; } else { - staticProperties.showSequenceNumbers = saveshowSequenceNumbers; + staticProperties.showSequenceNumbers = saveShowSequenceNumbers; } } From 8d5156ada2fbaad5b087dd824686ead87ef35387 Mon Sep 17 00:00:00 2001 From: will1742 Date: Fri, 9 Jul 2021 10:46:51 -0400 Subject: [PATCH 13/15] Accounted for offset issues after selection --- Haas_Next_Generation/haas vf2.cps | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index fa150d9..5fed4e3 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -2602,6 +2602,12 @@ function onSection() { // Create GOTO cases for Y/N selection, halt if N getTA("Net Share/Media/TAWarning.png", gotoRef['N'], onSecGotoRef); writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); + writeWords( + conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), + conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), + zOutput.format(initialPosition.z), + hFormat.format(lengthOffset) + ); writeComment("END VALIDATION SECTION"); // initialize spindle and engage coolant if heights are correct From 7aea377959d7d56b14665c756d9158b7c628c523 Mon Sep 17 00:00:00 2001 From: "Williams, Gavin J" Date: Fri, 9 Jul 2021 12:15:40 -0400 Subject: [PATCH 14/15] Removed hardcoded machine configs --- .gitignore | 3 ++- Haas_Next_Generation/haas vf2.cps | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f94f965..767cc43 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ Old/haas next generation.cps *.nc -Haas_Next_Generation/haas next* \ No newline at end of file +Haas_Next_Generation/haas next* +*.dmp \ No newline at end of file diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 5fed4e3..14283f9 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -1095,9 +1095,11 @@ function defineMachine() { function onOpen() { receivedMachineConfiguration = (typeof machineConfiguration.isReceived == "function") ? machineConfiguration.isReceived() : ((machineConfiguration.getDescription() != "") || machineConfiguration.isMultiAxisConfiguration()); - if (typeof defineMachine == "function") { + + // removed hardcoded machine configs to allow for simulation + /*if (typeof defineMachine == "function") { defineMachine(); // hardcoded machine configuration - } + }*/ activateMachine(); // enable the machine optimizations and settings if (staticProperties.useDPMFeeds) { From ee851e26285371e9c5f9d2441baa2e3157bf3e57 Mon Sep 17 00:00:00 2001 From: will1742 Date: Tue, 13 Jul 2021 10:09:01 -0400 Subject: [PATCH 15/15] Added Options For Post --- Haas_Next_Generation/haas vf2.cps | 141 +++++++++++++++++------------- 1 file changed, 79 insertions(+), 62 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 14283f9..34c4abb 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -57,8 +57,7 @@ allowSpiralMoves = true; highFeedrate = 650 * 25.4; // must be in MM // user-defined properties -/* -properties = { +properties = {/* machineModel: { title: "Machine model", description: "Specifies the pre-configured machine model.", @@ -73,7 +72,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.", @@ -112,7 +111,7 @@ properties = { ], value: "false", scope: "post" - }, + },/* useDPMFeeds: { title: "Rotary moves use DPM feeds", description: "Enable to output DPM feeds, disable for Inverse Time feeds with rotary axes moves.", @@ -120,7 +119,7 @@ properties = { type: "boolean", value: false, scope: "post" - }, + },*/ useTCPC: { title: "Use TCPC programming", description: "The control supports Tool Center Point Control programming.", @@ -128,7 +127,7 @@ properties = { type: "boolean", value: true, scope: "post" - }, + },/* useDWO: { title: "Use DWO", description: "Specifies that the Dynamic Work Offset feature (G254/G255) should be used.", @@ -284,7 +283,7 @@ properties = { type: "spatial", value: 0, scope: "post" - }, + },*/ useSubroutines: { title: "Use subroutines", description: "Select your desired subroutine option. 'All Operations' creates subroutines per each operation, 'Cycles' creates subroutines for cycle operations on same holes, and 'Patterns' creates subroutines for patterned operations.", @@ -298,7 +297,7 @@ properties = { group: 3, value: "allOperations", scope: "post" - }, + },/* writeMachine: { title: "Write machine", description: "Output the machine settings in the header of the code.", @@ -400,15 +399,12 @@ properties = { type: "boolean", value: true, scope: "post" - } + }*/ }; -*/ + staticProperties = { machineModel: "none", safePositionMethod: "G53", - hasAAxis: "reversed", - hasBAxis: "false", - hasCAxis: "true", useDPMFeeds: false, useTCPC: true, useDWO: true, @@ -427,9 +423,9 @@ staticProperties = { forceHomeOnIndexing: true, toolBreakageTolerance: 0.1, fastToolChange: false, - useG95forTapping: false, + useG95forTapping: true, safeRetractDistance: 0, - useSubroutines: "allOperations", //allOperations + //useSubroutines: "allOperations", writeMachine: false, writeTools: true, writeVersion: false, @@ -442,7 +438,6 @@ staticProperties = { useM130ToolImages: false, coolantPressure: "", singleResultsFile: true, - pencilWCSVerif: true }; const HAAS_DRILL = 1; @@ -595,8 +590,8 @@ function writeBlock() { if (!text) { return; } - var maximumSequenceNumber = ((staticProperties.useSubroutines == "allOperations") || (staticProperties.useSubroutines == "patterns") || - (staticProperties.useSubroutines == "cycles")) ? initialSubprogramNumber : 99999; + var maximumSequenceNumber = ((getProperty("useSubroutines") == "allOperations") || (getProperty("useSubroutines") == "patterns") || + (getProperty("useSubroutines") == "cycles")) ? initialSubprogramNumber : 99999; if (staticProperties.showSequenceNumbers) { if (sequenceNumber >= maximumSequenceNumber) { sequenceNumber = staticProperties.sequenceNumberStart; @@ -877,7 +872,7 @@ function setMacro(macro, value, comment) { } function defineMachineModel() { - var useTCPC = staticProperties.useTCPC; + var useTCPC = getProperty("useTCPC"); switch (staticProperties.machineModel) { case "umc-500": var axis1 = createAxis({coordinate:1, table:true, axis:[0, 1, 0], range:[-35, 120], preference:1, tcp:useTCPC}); @@ -1014,9 +1009,9 @@ function setFeedrateMode(reset) { } function defineMachine() { - hasA = staticProperties.hasAAxis != "false"; - hasB = staticProperties.hasBAxis != "false"; - hasC = staticProperties.hasCAxis != "false"; + hasA = getProperty("hasAAxis") != "false"; + hasB = getProperty("hasBAxis") != "false"; + hasC = getProperty("hasCAxis") != "false"; if (hasA && hasB && hasC) { error(localize("Only two rotary axes can be active at the same time.")); @@ -1033,9 +1028,9 @@ function defineMachine() { var aAxis; var bAxis; var cAxis; - var useTCPC = staticProperties.useTCPC; + var useTCPC = getProperty("useTCPC"); if (hasA) { // A Axis - For horizontal machines and trunnions - var dir = staticProperties.hasAAxis == "reversed" ? -1 : 1; + var dir = getProperty("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; @@ -1046,7 +1041,7 @@ function defineMachine() { } if (hasB) { // B Axis - For horizontal machines and trunnions - var dir = staticProperties.hasBAxis == "reversed" ? -1 : 1; + var dir = getProperty("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; @@ -1059,7 +1054,7 @@ function defineMachine() { } if (hasC) { // C Axis - For trunnions only - var dir = staticProperties.hasCAxis == "reversed" ? -1 : 1; + var dir = getProperty("hasCAxis") == "reversed" ? -1 : 1; cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, dir], cyclic:true, reset:1, tcp:useTCPC}); } @@ -1097,9 +1092,9 @@ function onOpen() { ((machineConfiguration.getDescription() != "") || machineConfiguration.isMultiAxisConfiguration()); // removed hardcoded machine configs to allow for simulation - /*if (typeof defineMachine == "function") { + if (typeof defineMachine == "function") { defineMachine(); // hardcoded machine configuration - }*/ + } activateMachine(); // enable the machine optimizations and settings if (staticProperties.useDPMFeeds) { @@ -1151,7 +1146,7 @@ function onOpen() { return; } - writeWords(writeComment(getGlobalParameter("username")), writeComment(getGlobalParameter("generated-at"))); + writeWords(writeComment(getGlobalParameter("username") + ": " + getGlobalParameter("document-path")), writeComment(getGlobalParameter("generated-at"))); if (staticProperties.useG0) { writeComment(localize("Using G0 which travels along dogleg path.")); @@ -1930,7 +1925,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { // convert patterns into subprograms var usePattern = false; patternIsActive = false; - if (currentSection.isPatterned && currentSection.isPatterned() && (staticProperties.useSubroutines == "patterns")) { + if (currentSection.isPatterned && currentSection.isPatterned() && (getProperty("useSubroutines") == "patterns")) { currentPattern = currentSection.getPatternId(); firstPattern = true; for (var i = 0; i < definedPatterns.length; ++i) { @@ -1978,7 +1973,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { } // Output cycle operation as subprogram - if (!usePattern && (staticProperties.useSubroutines == "cycles") && currentSection.doesStrictCycle && + if (!usePattern && (getProperty("useSubroutines") == "cycles") && currentSection.doesStrictCycle && (currentSection.getNumberOfCycles() == 1) && currentSection.getNumberOfCyclePoints() >= minimumCyclePoints) { var finalPosition = getFramePosition(currentSection.getFinalPosition()); currentPattern = currentSection.getNumberOfCyclePoints(); @@ -2013,7 +2008,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { } // Output each operation as a subprogram - if (!usePattern && (staticProperties.useSubroutines == "allOperations")) { + if (!usePattern && (getProperty("useSubroutines") == "allOperations")) { currentSubprogram = ++lastSubprogram; writeBlock(mFormat.format(97), "P" + nFormat.format(currentSubprogram)); firstPattern = true; @@ -2154,7 +2149,7 @@ function onSection() { // 07/06/21 | Gavin Williams | will1742 // 002 Improved Probing // uses pencil to verify WCS, prompts user - if (isFirstSection() && staticProperties.pencilWCSVerif) { + if (isFirstSection() && getProperty("pencilWCSValidation")) { var stockMidX = (stockUpperX + stockLowerX)/2; var stockMidY = (stockUpperY + stockLowerY)/2; writeln(""); @@ -2168,7 +2163,6 @@ function onSection() { var gotoRef = takeInput("Is the graphite probing device in the middle of the stock?", ['Y']); writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); - // TODO fix work offset for pencil on Z approach writeBlock(gFormat.format(55), gFormat.format(43), hFormat.format(19), zOutput.format(stockTopZ)); displayMedia("Net Share/Media/zWCSCheck.png"); writeBlock(mFormat.format(0), formatComment("Open door")); @@ -2581,40 +2575,45 @@ function onSection() { } } - writeComment("BEGIN VALIDATION SECTION"); - // Added 06/15/21 | Gavin Williams | will1742 - // Verifies tool-stock distance. Post fails if tool fails clearance standards - if (toolDistance < 1) { - throw "Error: Clearance height must be greater than 1 inch from stock"; - } + if (getProperty("toolHeightValidation")) { + writeComment("BEGIN VALIDATION SECTION"); + // Added 06/15/21 | Gavin Williams | will1742 + // Verifies tool-stock distance. Post fails if tool fails clearance standards + if (toolDistance < 1) { + throw "Error: Clearance height must be greater than 1 inch from stock"; + } - if (toolDistance == Infinity) { - throw "Error: invalid tool distance. Contact a TA."; - } - var toolDistance = initialPosition.z - stockTopZ; + if (toolDistance == Infinity) { + throw "Error: invalid tool distance. Contact a TA."; + } + var toolDistance = initialPosition.z - stockTopZ; + + // Prompt user to check stock-tool distance + displayMedia("Net Share/Media/checkDistance.png"); + writeBlock(mFormat.format(0), formatComment("Open door")); + displayMedia("Net Share/Media/arrowDown.png"); - // Prompt user to check stock-tool distance - displayMedia("Net Share/Media/checkDistance.png"); - writeBlock(mFormat.format(0), formatComment("Open door")); - displayMedia("Net Share/Media/arrowDown.png"); + // asks user if measured height is accurate to displayed + var gotoRef = takeInput(("Is the tool " + toolDistance.toPrecision(3) + "in from the stock? [Y/N]"), ['N', 'Y']); - // asks user if measured height is accurate to displayed - var gotoRef = takeInput(("Is the tool " + toolDistance.toPrecision(3) + "in from the stock? [Y/N]"), ['N', 'Y']); + // Create GOTO cases for Y/N selection, halt if N + getTA("Net Share/Media/TAWarning.png", gotoRef['N'], onSecGotoRef); + writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); + writeWords( + conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), + conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), + zOutput.format(initialPosition.z), + hFormat.format(lengthOffset) + ); + writeComment("END VALIDATION SECTION"); - // Create GOTO cases for Y/N selection, halt if N - getTA("Net Share/Media/TAWarning.png", gotoRef['N'], onSecGotoRef); - writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); - writeWords( - conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), - conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), - zOutput.format(initialPosition.z), - hFormat.format(lengthOffset) - ); - writeComment("END VALIDATION SECTION"); + // initialize spindle and engage coolant if heights are correct + if (tool.type != TOOL_PROBE) { + writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); + } + } - // initialize spindle and engage coolant if heights are correct if (tool.type != TOOL_PROBE) { - writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); setCoolant(tool.coolant); } @@ -4412,6 +4411,7 @@ longDescription = "Generic post for the HAAS Next Generation control with inspec var controlType = "NGC"; // Specifies the control model "NGC" or "Classic" // >>>>> INCLUDED FROM ../common/haas base inspection.cps +/* properties.probeLocalVar = { title: "Local variable start", description: "Specify the starting value for macro # variables that are to be used for calculations during inspection paths.", @@ -4536,6 +4536,23 @@ properties.calibrationNCOutput = { ], value: "none", scope: "post" +};*/ +properties.toolHeightValidation = { + title: "Tool Length Validation", + description: "Length validation. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" +}; + +properties.pencilWCSValidation = { + title: "WCS Validation", + description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" }; var ijkFormat = createFormat({decimals:5, forceDecimal:true});