diff --git a/Haas_Mills_BIDC/Bechtel VF2.cps b/Haas_Mills_BIDC/Bechtel VF2.cps index aea1f0f..265c9e8 100644 --- a/Haas_Mills_BIDC/Bechtel VF2.cps +++ b/Haas_Mills_BIDC/Bechtel VF2.cps @@ -894,7 +894,8 @@ function prepareForToolCheck() { } function writeToolMeasureBlock(tool, preMeasure) { - var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeBlockFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; + var writeWordsFunction = getProperty("measureToolsAtStart") ? writeWords() : writeWordsOptional; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; if (!preMeasure) { @@ -902,7 +903,7 @@ function writeToolMeasureBlock(tool, preMeasure) { } if (!staticProperties.useP9995) { // use Macro P9023 to measure tools var probingType = getHaasProbingTypeBIDC(tool.type, true); - writeFunction( + writeBlockFunction( gFormat.format(65), "P9023", "A" + probingType + ".", @@ -916,7 +917,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); - writeFunction( + writeBlockFunction( gFormat.format(65), "P9995", "A0.", @@ -928,20 +929,17 @@ function writeToolMeasureBlock(tool, preMeasure) { "K" + xyzFormat.format(getHaasKFactorBIDC(tool)), "I0.", comment - ); // probe tooling - var line1 = "IF [[#" + (2000 + tool.number) + " GT " + + ); // probe tool + 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)"; - - writeWords(getProperty("measureToolsAtStart") ? line1 : "/ " + line1); + (tool.bodyLength + tool.holderLength - LENGTH_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool length out of tolerance)"); + if (probeType == 3) { - var line2 = "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)"; - - writeWords(getProperty("measureToolsAtStart") ? line2 : "/ " + line2); + (tool.diameter - DIAM_TOLERANCE).toFixed(2) + "]] THEN #3000 = 1 (Tool diameter out of tolerance)"); } } measureTool = false; @@ -951,11 +949,15 @@ function writeToolMeasureBlock(tool, preMeasure) { // 002 Improved Probing // sets specified macro number with value function setMacro(macro, value, comment, isOptional) { - if (isOptional) { - writeWords("/ #" + macro + "=" + value, "(" + comment + ")"); - } else { - writeWords("#" + macro + "=" + value, "(" + comment + ")"); - } + if (isOptional) { + writeWordsOptional("#" + macro + "=" + value, "(" + comment + ")"); + } else { + writeWords("#" + macro + "=" + value, "(" + comment + ")"); + } +} + +function writeWordsOptional(text) { + writeWords("/ " + text); }