From 84af6ec06ebda52c36fba2a37e3f0e07610ea3e5 Mon Sep 17 00:00:00 2001 From: "Williams, Gavin J" Date: Tue, 7 Sep 2021 11:08:00 -0400 Subject: [PATCH] Revert "Optional tool measure blocks for SR" This reverts commit 0ea45c0d345de008dd7a0345eca28b3a36df97ad. --- Haas_Gantry_BIDC/Bechtel SR.cps | 122 +++++++++++++------------------- 1 file changed, 51 insertions(+), 71 deletions(-) diff --git a/Haas_Gantry_BIDC/Bechtel SR.cps b/Haas_Gantry_BIDC/Bechtel SR.cps index f92d238..1add6d0 100644 --- a/Haas_Gantry_BIDC/Bechtel SR.cps +++ b/Haas_Gantry_BIDC/Bechtel SR.cps @@ -281,7 +281,7 @@ properties = {/* description: "Tool Probing. By turning this off, you accept responsibility for any resulting crashes.", group: 99, type: "boolean", - value: false, + value: true, scope: "post" } }; @@ -663,8 +663,8 @@ function writeToolCycleBlock(tool) { } function prepareForToolCheck() { - onCommand(COMMAND_STOP_SPINDLE, false); - onCommand(COMMAND_COOLANT_OFF, false); + onCommand(COMMAND_STOP_SPINDLE); + onCommand(COMMAND_COOLANT_OFF); // cancel TCP so that tool doesn't follow tables if (currentSection.isMultiAxis() && (currentSection.getOptimizedTCPMode() == 0)) { @@ -678,31 +678,28 @@ function prepareForToolCheck() { } function BIDCWriteToolMeasureBlock(tool, rotating) { - - var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; - - writeFunction(gFormat.format(43), hFormat.format(tool.number)); + writeBlock(gFormat.format(43), hFormat.format(tool.number)); if (rotating && tool.type != HAAS_BALL_NOSE) { - writeFunction(gFormat.format(59), gFormat.format(0), xOutput.format(-tool.diameter/2), yOutput.format(0)); + writeBlock(gFormat.format(59), gFormat.format(0), xOutput.format(-tool.diameter/2), yOutput.format(0)); } else { - writeFunction(gFormat.format(59), gFormat.format(0), xOutput.format(0), yOutput.format(0)); + writeBlock(gFormat.format(59), gFormat.format(0), xOutput.format(0), yOutput.format(0)); } - writeFunction(mFormat.format(0)); + writeBlock(mFormat.format(0)); writeComment("TOOL PROBING"); - writeFunction(mFormat.format(83)); - writeFunction(gFormat.format(4), "P1."); - writeFunction(mFormat.format(84)); + writeBlock(mFormat.format(83)); + writeBlock(gFormat.format(4), "P1."); + writeBlock(mFormat.format(84)); if (rotating) { - writeFunction(sOutput.format(400), mFormat.format(!tool.clockwise ? 3 : 4)); + writeBlock(sOutput.format(400), mFormat.format(!tool.clockwise ? 3 : 4)); } - writeFunction(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(15)); - writeFunction(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); + writeBlock(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(15)); + writeBlock(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); if (rotating) { - writeFunction(sOutput.format(800)); + writeBlock(sOutput.format(800)); } - writeFunction(gFormat.format(37), hFormat.format(tool.number), zOutput.format(0), feedOutput.format(3)); - writeFunction(gAbsIncModal.format(91), gFormat.format(0), zOutput.format(.1), feedOutput.format(100)); - onCommand(COMMAND_STOP_SPINDLE, !getProperty("measureToolsAtStart")); + 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); } function writeToolMeasureBlock(tool, preMeasure) { @@ -860,10 +857,10 @@ function onOpen() { var tool = tools.getTool(i); // Added 8/31/21 | Kevin Pan | pan261 if (tool.number == 1) { - // throw "Tool number 1 is reserved for probing." + throw "Tool number 1 is reserved for probing." } if (tool.number == 2) { - // throw "Tool number 2 is not available for use." + throw "Tool number 2 is not available for use." } // pan261 @@ -890,9 +887,6 @@ function onOpen() { // optionally cycle through all tools if (staticProperties.optionallyCycleToolsAtStart || staticProperties.optionallyMeasureToolsAtStart) { var tools = getToolTable(); - - var writeFunction = getProperty("measureToolsAtStart") ? writeBlock : writeOptionalBlock; - if (tools.getNumberOfTools() > 0) { /* @@ -926,10 +920,10 @@ function onOpen() { // writeRetract(Z); // } // writeBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); //Changes Tool - writeToolChange(tool.number, !getProperty("measureToolsAtStart")) + writeToolChange(tool.number) writeComment("SET LENGTH AND RADIUS"); - writeFunction(gFormat.format(10), "L" + 10, "P" + tool.number, "R" + (tool.holderLength + tool.bodyLength).toFixed(4)); - writeFunction(gFormat.format(10), "L" + 12, "P" + tool.number, "R" + (tool.diameter).toFixed(4)); + 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"); // 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 @@ -1020,7 +1014,7 @@ function onOpen() { } if (staticProperties.chipTransport) { - onCommand(COMMAND_START_CHIP_TRANSPORT, false); + onCommand(COMMAND_START_CHIP_TRANSPORT); } // Probing Surface Inspection if (typeof inspectionWriteVariables == "function") { @@ -1277,7 +1271,7 @@ function defineWorkPlane(_section, _setWorkPlane) { writeRetract(Z); } forceWorkPlane(); - onCommand(COMMAND_UNLOCK_MULTI_AXIS, false); + onCommand(COMMAND_UNLOCK_MULTI_AXIS); gMotionModal.reset(); writeBlock( gMotionModal.format(0), @@ -1321,7 +1315,7 @@ function setWorkPlane(abc) { } skipBlock = _skipBlock; - onCommand(COMMAND_UNLOCK_MULTI_AXIS, false); + onCommand(COMMAND_UNLOCK_MULTI_AXIS); gMotionModal.reset(); skipBlock = _skipBlock; @@ -1333,7 +1327,7 @@ function setWorkPlane(abc) { ); skipBlock = _skipBlock; - onCommand(COMMAND_LOCK_MULTI_AXIS, false); + onCommand(COMMAND_LOCK_MULTI_AXIS); currentWorkPlaneABC = abc; } @@ -1708,25 +1702,13 @@ function setAbsoluteMode(xyz, abc) { } } -function writeToolChange(toolNum, isOptional) { - if (isOptional) { - if (!retracted) { - skipBlock = true; - writeRetract(Z); - } - skipBlock = true; - writeRetract(X, Y); - writeOptionalBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool - skipBlock = true; - writeRetract(Z); - } else { - if (!retracted) { - writeRetract(Z); - } - writeRetract(X, Y); - writeBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool +function writeToolChange(toolNum) { + if (!retracted) { writeRetract(Z); } + writeRetract(X, Y); + writeBlock("T" + toolFormat.format(toolNum), mFormat.format(6)); //Changes Tool + writeRetract(Z); } function onSection() { @@ -1773,7 +1755,7 @@ function onSection() { if (staticProperties.fastToolChange && !isProbeOperation()) { currentCoolantMode = COOLANT_OFF; } else if (insertToolCall) { // no coolant off command if safe start operation - onCommand(COMMAND_COOLANT_OFF, false); + onCommand(COMMAND_COOLANT_OFF); } } @@ -1781,7 +1763,7 @@ function onSection() { // stop spindle before retract during tool change if (insertToolCall && !isFirstSection() && !toolChecked && !staticProperties.fastToolChange) { - onCommand(COMMAND_STOP_SPINDLE, false); + onCommand(COMMAND_STOP_SPINDLE); } // retract to safe plane @@ -1818,7 +1800,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) { @@ -1850,7 +1832,7 @@ function onSection() { if (insertToolCall || operationNeedsSafeStart) { if (!isFirstSection() && staticProperties.optionalStop && insertToolCall) { - onCommand(COMMAND_OPTIONAL_STOP, false); + onCommand(COMMAND_OPTIONAL_STOP); } if ((tool.number > 200 && tool.number < 1000) || tool.number > 9999) { @@ -1893,12 +1875,12 @@ function onSection() { // activate those two coolant modes before the spindle is turned on if ((tool.coolant == COOLANT_THROUGH_TOOL) || (tool.coolant == COOLANT_AIR_THROUGH_TOOL) || (tool.coolant == COOLANT_FLOOD_THROUGH_TOOL)) { if (!isFirstSection() && !insertToolCall && (currentCoolantMode != tool.coolant)) { - onCommand(COMMAND_STOP_SPINDLE, false); + onCommand(COMMAND_STOP_SPINDLE); forceSpindleSpeed = true; } setCoolant(tool.coolant); } else if ((currentCoolantMode == COOLANT_THROUGH_TOOL) || (currentCoolantMode == COOLANT_AIR_THROUGH_TOOL) || (currentCoolantMode == COOLANT_FLOOD_THROUGH_TOOL)) { - onCommand(COMMAND_STOP_SPINDLE, false); + onCommand(COMMAND_STOP_SPINDLE); setCoolant(COOLANT_OFF); forceSpindleSpeed = true; } @@ -3528,17 +3510,15 @@ var mapCommand = { COMMAND_LOAD_TOOL:6 }; -function onCommand(command, isOptional) { - var writeFunction = isOptional ? writeOptionalBlock : writeBlock; - +function onCommand(command) { switch (command) { case COMMAND_STOP: - writeFunction(mFormat.format(0)); + writeBlock(mFormat.format(0)); forceSpindleSpeed = true; forceCoolant = true; return; case COMMAND_OPTIONAL_STOP: - writeFunction(mFormat.format(1)); + writeBlock(mFormat.format(1)); forceSpindleSpeed = true; forceCoolant = true; return; @@ -3554,27 +3534,27 @@ function onCommand(command, isOptional) { case COMMAND_LOCK_MULTI_AXIS: if (machineConfiguration.isMultiAxisConfiguration() && (machineConfiguration.getNumberOfAxes() >= 4)) { var _skipBlock = skipBlock; - writeFunction(mFormat.format(10)); // lock 4th-axis motion + writeBlock(mFormat.format(10)); // lock 4th-axis motion if (machineConfiguration.getNumberOfAxes() == 5) { skipBlock = _skipBlock; - writeFunction(mFormat.format(12)); // lock 5th-axis motion + writeBlock(mFormat.format(12)); // lock 5th-axis motion } } return; case COMMAND_UNLOCK_MULTI_AXIS: if (machineConfiguration.isMultiAxisConfiguration() && (machineConfiguration.getNumberOfAxes() >= 4)) { var _skipBlock = skipBlock; - writeFunction(mFormat.format(11)); // unlock 4th-axis motion + writeBlock(mFormat.format(11)); // unlock 4th-axis motion if (machineConfiguration.getNumberOfAxes() == 5) { skipBlock = _skipBlock; - writeFunction(mFormat.format(13)); // unlock 5th-axis motion + writeBlock(mFormat.format(13)); // unlock 5th-axis motion } } return; case COMMAND_BREAK_CONTROL: if (!toolChecked) { // avoid duplicate COMMAND_BREAK_CONTROL prepareForToolCheck(); - writeFunction( + writeBlock( gFormat.format(65), "P" + 9853, "T" + toolFormat.format(tool.number), @@ -3589,10 +3569,10 @@ function onCommand(command, isOptional) { measureTool = true; return; case COMMAND_START_CHIP_TRANSPORT: - writeFunction(mFormat.format(31)); + writeBlock(mFormat.format(31)); return; case COMMAND_STOP_CHIP_TRANSPORT: - writeFunction(mFormat.format(33)); + writeBlock(mFormat.format(33)); return; case COMMAND_PROBE_ON: return; @@ -3603,7 +3583,7 @@ function onCommand(command, isOptional) { var stringId = getCommandStringId(command); var mcode = mapCommand[stringId]; if (mcode != undefined) { - writeFunction(mFormat.format(mcode)); + writeBlock(mFormat.format(mcode)); } else { onUnsupportedCommand(command); } @@ -3626,7 +3606,7 @@ function onSectionEnd() { if ((((getCurrentSectionId() + 1) >= getNumberOfSections()) || (tool.number != getNextSection().getTool().number)) && tool.breakControl) { - onCommand(COMMAND_BREAK_CONTROL, false); + onCommand(COMMAND_BREAK_CONTROL); } else { toolChecked = false; } @@ -3858,8 +3838,8 @@ function onClose() { optionalSection = false; - onCommand(COMMAND_STOP_SPINDLE, false); - onCommand(COMMAND_COOLANT_OFF, false); + onCommand(COMMAND_STOP_SPINDLE); + onCommand(COMMAND_COOLANT_OFF); // retract writeRetract(Z);