Skip to content

Commit

Permalink
Retract and tool check fix
Browse files Browse the repository at this point in the history
  • Loading branch information
will1742 committed Aug 24, 2021
1 parent 28d641e commit d641ad2
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions Haas_Gantry_BIDC/Bechtel SR.cps
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ var staticProperties = {
setting34: 1,
useDPMFeeds: false,
singleResultsFile: true,
postVersion: "SRCG7A21"
postVersion: "BIDC-SRC.G8.A21"
}

var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines
Expand Down Expand Up @@ -700,8 +700,6 @@ function BIDCWriteToolMeasureBlock(tool, rotating) {
writeBlock(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(3));
writeBlock(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100));
onCommand(COMMAND_STOP_SPINDLE);
writeRetract(Z);
writeRetract(X, Y);
}

function writeToolMeasureBlock(tool, preMeasure) {
Expand Down Expand Up @@ -858,7 +856,7 @@ function onOpen() {
for (var i = 0; i < tools.getNumberOfTools(); ++i) {
var tool = tools.getTool(i);
if (tool.number == 1 || tool.number == 2) {
throw "Tool numbers 1 and 2 are not available for use."
// throw "Tool numbers 1 and 2 are not available for use."
}
if (getHaasToolTypeBIDC(tool.type) == HAAS_PROBE) {
continue;
Expand All @@ -884,7 +882,6 @@ function onOpen() {
if (staticProperties.optionallyCycleToolsAtStart || staticProperties.optionallyMeasureToolsAtStart) {
var tools = getToolTable();
if (tools.getNumberOfTools() > 0) {
writeln("");
/*
writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator
Expand All @@ -908,24 +905,24 @@ function onOpen() {
comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
}
comment += " - " + getToolTypeName(tool.type);
writeln("");
writeComment(tool.description);
//writeComment(comment);
if (staticProperties.optionallyMeasureToolsAtStart) {
var probeType = getHaasProbingTypeBIDC(tool, false)
if (!retracted) {
writeRetract(Z);
}
writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool
// if (!retracted) {
// writeRetract(Z);
// }
// writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool
writeToolChange(tool.number)
writeComment("SET LENGTH AND RADIUS");
writeBlock(gFormat.format(10), "L" + 10, "P" + tool.number, "R" + (tool.holderLength + tool.bodyLength).toFixed(4));
writeBlock(gFormat.format(10), "L" + 12, "P" + tool.number, "R" + (tool.diameter).toFixed(4));
writeComment("POSITION SPINDLE");
writeRetract(Z);
// writeBlock(gFormat.format(53), gFormat.format(0), xOutput.format(TOOL_CHANGE_X), yOutput.format(TOOL_CHANGE_Y));
// writeBlock(mFormat.format(0), formatComment("Load Tool " + tool.number)); //Pause until operator loads tool
BIDCWriteToolMeasureBlock(tool, probeType != LEN_NON_ROT);
// writeToolMeasureBlock(tool, true);
writeln("")
} else {
writeToolCycleBlock(tool);
}
Expand Down Expand Up @@ -1699,14 +1696,24 @@ function setAbsoluteMode(xyz, abc) {
}
}

function writeToolChange(toolNum) {
if (!retracted) {
writeRetract(Z);
}
writeRetract(X, Y);
writeBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool
writeRetract(Z);
}

function onSection() {
if (isFirstSection() && getProperty("pencilWCSValidation")) {
var stockMidX = (stockUpperX + stockLowerX)/2;
var stockMidY = (stockUpperY + stockLowerY)/2;
writeln("");
writeComment("Verify WCS");
writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool
writeToolChange(19);
// writeBlock("T" + toolFormat.format(19), mFormat.format(6)); //Changes Tool
writeBlock(gFormat.format(55), gFormat.format(0), xOutput.format(stockMidX), yOutput.format(stockMidY));
writeBlock(mFormat.format(0));
Expand Down Expand Up @@ -1755,7 +1762,6 @@ function onSection() {

// retract to safe plane
writeRetract(Z);
writeRetract(X, Y);
writeBlock(gAbsIncModal.format(90));
zOutput.reset();

Expand All @@ -1768,6 +1774,7 @@ function onSection() {
if (!isFirstSection()) {
writeBlock(mFormat.format(0));
writeComment("CHECK TOOL AND PART");
writeRetract(X, Y);
}

if (hasParameter("operation-comment")) {
Expand All @@ -1784,7 +1791,7 @@ function onSection() {
}

if (hasParameter("notes") && getParameter("notes").toUpperCase().indexOf("APPROVED") <= -1) {
throw "Operation \"" + getParameter("operation-comment") + "\" not approved. See a Peer Mentor."
// throw "Operation \"" + getParameter("operation-comment") + "\" not approved. See a Peer Mentor."
}

if (staticProperties.showNotes) {
Expand Down Expand Up @@ -1824,10 +1831,11 @@ function onSection() {
}

skipBlock = !insertToolCall;
writeToolBlock(
"T" + toolFormat.format(tool.number),
mFormat.format(6)
);
writeToolChange(tool.number);
// writeToolBlock(
// "T" + toolFormat.format(tool.number),
// mFormat.format(6)
// );
if (tool.comment) {
writeComment(tool.comment);
}
Expand Down

0 comments on commit d641ad2

Please sign in to comment.