Skip to content

Commit

Permalink
Revert "Fixed null bug with optional tool measuring"
Browse files Browse the repository at this point in the history
This reverts commit 73e4a41.
  • Loading branch information
will1742 committed Sep 7, 2021
1 parent 35910ec commit 5133b7b
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions Haas_Mills_BIDC/Bechtel VF2.cps
Original file line number Diff line number Diff line change
Expand Up @@ -894,15 +894,16 @@ 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) {
prepareForToolCheck();
}
if (!staticProperties.useP9995) { // use Macro P9023 to measure tools
var probingType = getHaasProbingTypeBIDC(tool.type, true);
writeFunction(
writeBlockFunction(
gFormat.format(65),
"P9023",
"A" + probingType + ".",
Expand All @@ -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.",
Expand All @@ -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;
Expand All @@ -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);
}


Expand Down

0 comments on commit 5133b7b

Please sign in to comment.