Skip to content

Commit

Permalink
Added tolerance checks
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Jul 14, 2021
1 parent f0f7f15 commit 366e29d
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions Haas_Next_Generation/haas vf2.cps
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -849,19 +851,31 @@ 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),
"K" + xyzFormat.format(getHaasKFactorBIDC(tool)),
"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;
}
Expand Down Expand Up @@ -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)) {
Expand All @@ -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("");
}

Expand Down Expand Up @@ -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"));
}

Expand Down

0 comments on commit 366e29d

Please sign in to comment.