From 366e29d644329407a8c7a5ceb7ef33d5b006f11f Mon Sep 17 00:00:00 2001 From: will1742 Date: Wed, 14 Jul 2021 16:14:16 -0400 Subject: [PATCH] Added tolerance checks --- Haas_Next_Generation/haas vf2.cps | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index b5e53b2..8515a23 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -457,6 +457,8 @@ staticProperties = { const NULL_HAAS_K_FACTOR = 0; const CLEARANCE_HEIGHT = 1; + const LENGTH_TOLERANCE = .25; + const DIAM_TOLERANCE = .01; var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines // samples: @@ -849,12 +851,13 @@ 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"); + var probeType = getHaasProbingTypeBIDC(tool, false) writeFunction( gFormat.format(65), "P9995", "A0.", "B" + getHaasToolTypeBIDC(tool.type) + ".", - "C" + getHaasProbingTypeBIDC(tool, false) + ".", + "C" + probeType + ".", "T" + toolFormat.format(tool.number), "E" + xyzFormat.format(tool.bodyLength + tool.holderLength), "D" + xyzFormat.format(tool.diameter), @@ -862,6 +865,17 @@ function writeToolMeasureBlock(tool, preMeasure) { "I0.", comment ); // probe tool + writeFunction("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) { + writeFunction("IF [[#" + (2000 + tool.number) + " GT " + + (tool.diameter + DIAM_TOLERANCE).toFixed(2) + "] OR [#" + + (2000 + tool.number) + " LT " + + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); + } } measureTool = false; } @@ -1265,6 +1279,7 @@ function onOpen() { gFormat.format(80), gFormat.format(90), formatComment("Reset work plane, cancel all cycles and offsets")); + //displayMedia("toolProbeWarning.jpeg"); for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); if (staticProperties.measureToolsAtStart && (tool.type == TOOL_PROBE)) { @@ -1283,12 +1298,12 @@ 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); } } } + //writeBlock(mFormat.format(131)); writeln(""); } @@ -2162,14 +2177,22 @@ function onSection() { 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']); + var gotoRef = takeInput("Is the pencil centered above your stock? stock? [Y/N]", ['N', 'Y']); + + writeWords("N" + nFormat.format(gotoRef['N']), mFormat.format(131)); + writeWords(mFormat.format(02), formatComment("Halt Program")); + 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']); + gotoRef = takeInput("Is the pencil touching the center of your stock? [Y/N]", ['N', 'Y']); + + writeWords("N" + nFormat.format(gotoRef['N']), mFormat.format(131)); + writeWords(mFormat.format(02), formatComment("Halt Program")); + writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); }