diff --git a/Haas_Next_Generation/README.txt b/Haas_Next_Generation/README.txt index 800ec8d..3bb58f8 100644 --- a/Haas_Next_Generation/README.txt +++ b/Haas_Next_Generation/README.txt @@ -3,6 +3,7 @@ Changelog 06/14/21 Added media and QA 06/15/21 Check tool distance from stock, finalized QA 06/21/21 Tool probing required, tool probing now uses P9995 +06/28/21 Tool specific probing added, with cases for type of probing and k factor Function List: @@ -25,6 +26,10 @@ takeInput(prompt, options) any number of options can be input, sequenceNumbers will be adjusted to compensate +setMacro(macro, value, comment) + sets specified macro, adds inline comment + + General notes: - staticProperties is a dictionary containing all properties previously allowed to be altered by the user. @@ -32,4 +37,8 @@ General notes: - Some optional portions were commented out, specifically those associated with safe start. +<<<<<<< HEAD - Potential TODO is to remove as much halting from QA as possible +======= +- Macro references can be found on page 189 of the milling manual +>>>>>>> Development diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index 65f8421..34c4abb 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -8,6 +8,9 @@ $Date: 2021-06-01 08:35:38 $ FORKID {DBD402DA-DE90-4634-A6A3-0AE5CC97DEC7} + + Modified by BIDC of Purdue University + Authors: Gavin Williams (will1742@purdue.edu) */ // >>>>> INCLUDED FROM ../../../haas next generation.cps @@ -54,8 +57,7 @@ allowSpiralMoves = true; highFeedrate = 650 * 25.4; // must be in MM // user-defined properties -/* -properties = { +properties = {/* machineModel: { title: "Machine model", description: "Specifies the pre-configured machine model.", @@ -70,7 +72,7 @@ properties = { ], value: "none", scope: "post" - }, + },*/ hasAAxis: { title: "Has A-axis rotary", description: "Enable if the machine has an A-axis table/trunnion. Check the table direction on the machine and use the (Reversed) selection if the table is moving in the opposite direction.", @@ -109,7 +111,7 @@ properties = { ], value: "false", scope: "post" - }, + },/* useDPMFeeds: { title: "Rotary moves use DPM feeds", description: "Enable to output DPM feeds, disable for Inverse Time feeds with rotary axes moves.", @@ -117,7 +119,7 @@ properties = { type: "boolean", value: false, scope: "post" - }, + },*/ useTCPC: { title: "Use TCPC programming", description: "The control supports Tool Center Point Control programming.", @@ -125,7 +127,7 @@ properties = { type: "boolean", value: true, scope: "post" - }, + },/* useDWO: { title: "Use DWO", description: "Specifies that the Dynamic Work Offset feature (G254/G255) should be used.", @@ -281,7 +283,7 @@ properties = { type: "spatial", value: 0, scope: "post" - }, + },*/ useSubroutines: { title: "Use subroutines", description: "Select your desired subroutine option. 'All Operations' creates subroutines per each operation, 'Cycles' creates subroutines for cycle operations on same holes, and 'Patterns' creates subroutines for patterned operations.", @@ -295,7 +297,7 @@ properties = { group: 3, value: "allOperations", scope: "post" - }, + },/* writeMachine: { title: "Write machine", description: "Output the machine settings in the header of the code.", @@ -397,21 +399,18 @@ properties = { type: "boolean", value: true, scope: "post" - } + }*/ }; -*/ + staticProperties = { machineModel: "none", safePositionMethod: "G53", - hasAAxis: "false", - hasBAxis: "false", - hasCAxis: "false", useDPMFeeds: false, useTCPC: true, useDWO: true, safeStartAllOperations: true, preloadTool: true, - chipTransport: true, + chipTransport: false, optionalStop: true, separateWordsWithSpace: true, useRadius: false, @@ -424,9 +423,9 @@ staticProperties = { forceHomeOnIndexing: true, toolBreakageTolerance: 0.1, fastToolChange: false, - useG95forTapping: false, + useG95forTapping: true, safeRetractDistance: 0, - useSubroutines: "allOperations", //allOperations + //useSubroutines: "allOperations", writeMachine: false, writeTools: true, writeVersion: false, @@ -438,9 +437,25 @@ staticProperties = { useM130PartImages: false, useM130ToolImages: false, coolantPressure: "", - singleResultsFile: true + singleResultsFile: true, }; + const HAAS_DRILL = 1; + const HAAS_TAP = 2; + const HAAS_SHELL = 3; + const HAAS_END_MILL = 4; + const HAAS_CENTER = 5; + const HAAS_BALL_NOSE = 6; + const HAAS_PROBE = 7; + + const NO_PROBING = 0; + const LEN_ROT = 1; + const LEN_NON_ROT = 2; + const LEN_DIA_ROT = 3; + + const DEFAULT_HAAS_K_FACTOR = 0.05; + const NULL_HAAS_K_FACTOR = 0; + var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines // samples: // {id: COOLANT_THROUGH_TOOL, on: 88, off: 89} @@ -575,8 +590,8 @@ function writeBlock() { if (!text) { return; } - var maximumSequenceNumber = ((staticProperties.useSubroutines == "allOperations") || (staticProperties.useSubroutines == "patterns") || - (staticProperties.useSubroutines == "cycles")) ? initialSubprogramNumber : 99999; + var maximumSequenceNumber = ((getProperty("useSubroutines") == "allOperations") || (getProperty("useSubroutines") == "patterns") || + (getProperty("useSubroutines") == "cycles")) ? initialSubprogramNumber : 99999; if (staticProperties.showSequenceNumbers) { if (sequenceNumber >= maximumSequenceNumber) { sequenceNumber = staticProperties.sequenceNumberStart; @@ -668,7 +683,7 @@ function getHaasToolType(toolType) { } function getHaasProbingType(toolType, use9023) { - switch (getHaasToolType(toolType)) { + switch (getHaasToolType(toolType.type)) { case 3: case 4: return (use9023 ? 23 : 1); // rotate @@ -686,6 +701,111 @@ function getHaasProbingType(toolType, use9023) { } } +function getHaasToolTypeBIDC(toolType) { + switch (toolType) { + case TOOL_DRILL: + case TOOL_REAMER: + return HAAS_DRILL; // drill + case TOOL_TAP_RIGHT_HAND: + case TOOL_TAP_LEFT_HAND: + return HAAS_TAP; // tap + case TOOL_MILLING_FACE: + case TOOL_MILLING_SLOT: + case TOOL_BORING_BAR: + return HAAS_SHELL; // shell mill + case TOOL_MILLING_END_FLAT: + case TOOL_MILLING_END_BULLNOSE: + case TOOL_MILLING_TAPERED: + case TOOL_MILLING_DOVETAIL: + case TOOL_MILLING_THREAD: + return HAAS_END_MILL; // end mill + case TOOL_DRILL_SPOT: + case TOOL_MILLING_CHAMFER: + case TOOL_DRILL_CENTER: + case TOOL_COUNTER_SINK: + case TOOL_COUNTER_BORE: + case TOOL_MILLING_FORM: + return HAAS_CENTER; // center drill + case TOOL_MILLING_END_BALL: + case TOOL_MILLING_LOLLIPOP: + case TOOL_MILLING_RADIUS: + return HAAS_BALL_NOSE; // ball nose + case TOOL_PROBE: + return HAAS_PROBE; // probe + default: + error(localize("Invalid HAAS tool type.")); + return -1; + } +} + +// 06/25/21 | Gavin Williams | will1742 +// 002 Probing +function formatCNumber(probeType, use9023){ + if (use9023) { + if (probeType == LEN_NON_ROT || probeType == LEN_DIA_ROT){ + return probeType + 10; + } + return 23; + } + return probeType; +} + +function getHaasProbingTypeBIDC(tool, use9023) { + switch (getHaasToolTypeBIDC(tool.type)) { + case HAAS_PROBE: + return formatCNumber(NO_PROBING, use9023); + case HAAS_TAP: + case HAAS_DRILL: + return formatCNumber(LEN_NON_ROT, use9023); + case HAAS_CENTER: + if (tool.type == TOOL_MILLING_FORM) { + return formatCNumber(NO_PROBING, use9023); + } + return formatCNumber(LEN_NON_ROT, use9023); + case HAAS_END_MILL: + return formatCNumber((tool.type == TOOL_MILLING_TAPERED ? LEN_ROT : LEN_DIA_ROT), use9023); + case HAAS_BALL_NOSE: + return formatCNumber((tool.type == TOOL_MILLING_RADIUS ? LEN_ROT : LEN_DIA_ROT), use9023); + case HAAS_SHELL: + if ((tool.type == TOOL_MILLING_FACE) && (tool.taperAngle !=0)) { + return formatCNumber(LEN_ROT, use9023); + } + return formatCNumber(LEN_DIA_ROT, use9023); + default: + return -1; + } +} + +function getHaasKFactorBIDC(tool) { + switch (getHaasToolTypeBIDC(tool.type)) { + case HAAS_SHELL: + case HAAS_END_MILL: + if (tool.type == TOOL_BORING_BAR || tool.type == TOOL_MILLING_END_FLAT) { + return DEFAULT_HAAS_K_FACTOR; + } + if (tool.type == TOOL_MILLING_FACE && tool.taperAngle != 0) { + return NULL_HAAS_K_FACTOR; + } + if (tool.type == TOOL_MILLING_THREAD) { + return DEFAULT_HAAS_K_FACTOR + tool.getThreadPitch(); + } + return DEFAULT_HAAS_K_FACTOR + tool.cornerRadius; + case HAAS_BALL_NOSE: + if (tool.type == TOOL_MILLING_RADIUS) { + return NULL_HAAS_K_FACTOR; + } + return DEFAULT_HAAS_K_FACTOR + (tool.diameter/2); + case HAAS_CENTER: + case HAAS_PROBE: + case HAAS_DRILL: + case HAAS_TAP: + + return NULL_HAAS_K_FACTOR; + default: + return -1; + } +} + function writeToolCycleBlock(tool) { writeOptionalBlock("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool writeOptionalBlock(mFormat.format(0)); // wait for operator @@ -710,7 +830,6 @@ function writeToolMeasureBlock(tool, preMeasure) { // var writeFunction = measureTool ? writeBlock : writeOptionalBlock; var writeFunction = writeBlock; var comment = measureTool ? formatComment("MEASURE TOOL") : ""; - if (!preMeasure) { prepareForToolCheck(); } @@ -727,16 +846,17 @@ 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"); writeFunction( gFormat.format(65), "P9995", "A0.", - "B" + getHaasToolType(tool.type) + ".", - "C" + getHaasProbingType(tool.type, false) + ".", + "B" + getHaasToolTypeBIDC(tool.type) + ".", + "C" + getHaasProbingTypeBIDC(tool, false) + ".", "T" + toolFormat.format(tool.number), "E" + xyzFormat.format(tool.bodyLength + tool.holderLength), "D" + xyzFormat.format(tool.diameter), - "K" + xyzFormat.format(0.1), + "K" + xyzFormat.format(getHaasKFactorBIDC(tool)), "I0.", comment ); // probe tool @@ -744,8 +864,15 @@ function writeToolMeasureBlock(tool, preMeasure) { measureTool = false; } +// 6/28/21 | Gavin Williams | will1742 +// 002 Improved Probing +// sets specified macro number with value +function setMacro(macro, value, comment) { + writeWords("#" + macro + "=" + value, "(" + comment + ")"); +} + function defineMachineModel() { - var useTCPC = staticProperties.useTCPC; + var useTCPC = getProperty("useTCPC"); switch (staticProperties.machineModel) { case "umc-500": var axis1 = createAxis({coordinate:1, table:true, axis:[0, 1, 0], range:[-35, 120], preference:1, tcp:useTCPC}); @@ -833,7 +960,7 @@ function activateMachine() { } // retract/reconfigure - safeRetractDistance = staticProperties.singleResultsFile != undefined ? staticProperties.singleResultsFile : + safeRetractDistance = staticProperties.safeRetractDistance != undefined ? staticProperties.safeRetractDistance : (typeof safeRetractDistance == "number" ? safeRetractDistance : 0); if (machineConfiguration.performRewinds() || (typeof performRewinds == "undefined" ? false : performRewinds)) { machineConfiguration.enableMachineRewinds(); // enables the rewind/reconfigure logic @@ -857,11 +984,11 @@ function activateMachine() { var section = getSection(i); if (section.isMultiAxis()) { machineConfiguration.setToolLength(section.getTool().getBodyLength()); // define the tool length for head adjustments - section.optimizeMachineAnglesByMachine(machineConfiguration, OPTIMIZE_AXIS); + section.optimizeMachineAnglesByMachine(machineConfiguration, tcpIsSupported ? 0 : 1); } } } else { - optimizeMachineAngles2(OPTIMIZE_AXIS); + optimizeMachineAngles2(tcpIsSupported ? 0 : 1); } } @@ -882,9 +1009,9 @@ function setFeedrateMode(reset) { } function defineMachine() { - hasA = staticProperties.hasAAxis != "false"; - hasB = staticProperties.hasBAxis != "false"; - hasC = staticProperties.hasCAxis != "false"; + hasA = getProperty("hasAAxis") != "false"; + hasB = getProperty("hasBAxis") != "false"; + hasC = getProperty("hasCAxis") != "false"; if (hasA && hasB && hasC) { error(localize("Only two rotary axes can be active at the same time.")); @@ -901,9 +1028,9 @@ function defineMachine() { var aAxis; var bAxis; var cAxis; - var useTCPC = staticProperties.useTCPC; + var useTCPC = getProperty("useTCPC"); if (hasA) { // A Axis - For horizontal machines and trunnions - var dir = staticProperties.hasAAxis == "reversed" ? -1 : 1; + var dir = getProperty("hasAAxis") == "reversed" ? -1 : 1; if (hasC || hasB) { var aMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var aMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -914,7 +1041,7 @@ function defineMachine() { } if (hasB) { // B Axis - For horizontal machines and trunnions - var dir = staticProperties.hasBAxis == "reversed" ? -1 : 1; + var dir = getProperty("hasBAxis") == "reversed" ? -1 : 1; if (hasC) { var bMin = (dir == 1) ? -120 - 0.0001 : -30 - 0.0001; var bMax = (dir == 1) ? 30 + 0.0001 : 120 + 0.0001; @@ -927,7 +1054,7 @@ function defineMachine() { } if (hasC) { // C Axis - For trunnions only - var dir = staticProperties.hasCAxis == "reversed" ? -1 : 1; + var dir = getProperty("hasCAxis") == "reversed" ? -1 : 1; cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, dir], cyclic:true, reset:1, tcp:useTCPC}); } @@ -963,6 +1090,8 @@ function defineMachine() { function onOpen() { receivedMachineConfiguration = (typeof machineConfiguration.isReceived == "function") ? machineConfiguration.isReceived() : ((machineConfiguration.getDescription() != "") || machineConfiguration.isMultiAxisConfiguration()); + + // removed hardcoded machine configs to allow for simulation if (typeof defineMachine == "function") { defineMachine(); // hardcoded machine configuration } @@ -991,9 +1120,10 @@ function onOpen() { if (!staticProperties.separateWordsWithSpace) { setWordSeparator(""); } - saveshowSequenceNumbers = staticProperties.showSequenceNumbers; + saveShowSequenceNumbers = staticProperties.showSequenceNumbers; sequenceNumber = staticProperties.sequenceNumberStart; writeln("%"); + if (programName) { var programId; try { @@ -1016,7 +1146,7 @@ function onOpen() { return; } - writeWords(writeComment(getGlobalParameter("username")), writeComment(getGlobalParameter("generated-at"))); + writeWords(writeComment(getGlobalParameter("username") + ": " + getGlobalParameter("document-path")), writeComment(getGlobalParameter("generated-at"))); if (staticProperties.useG0) { writeComment(localize("Using G0 which travels along dogleg path.")); @@ -1146,10 +1276,12 @@ function onOpen() { } comment += " - " + getToolTypeName(tool.type); writeComment(comment); + writeComment(tool.description); if (staticProperties.measureToolsAtStart) { 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); } @@ -1699,6 +1831,10 @@ function onManualNC(command, value) { var probeOutputWorkOffset = 1; var stockTopZ = -1; +var stockUpperX; +var stockLowerX; +var stockUpperY; +var stockLowerY; function onParameter(name, value) { if (name == "probe-output-work-offset") { @@ -1710,6 +1846,18 @@ function onParameter(name, value) { if (name == "stock-upper-z") { stockTopZ = value; } + if (name == "stock-upper-x") { + stockUpperX = value; + } + if (name == "stock-lower-x") { + stockLowerX = value; + } + if (name == "stock-upper-y") { + stockUpperY = value; + } + if (name == "stock-lower-y") { + stockLowerY = value; + } } var seenPatternIds = {}; @@ -1777,7 +1925,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { // convert patterns into subprograms var usePattern = false; patternIsActive = false; - if (currentSection.isPatterned && currentSection.isPatterned() && (staticProperties.useSubroutines == "patterns")) { + if (currentSection.isPatterned && currentSection.isPatterned() && (getProperty("useSubroutines") == "patterns")) { currentPattern = currentSection.getPatternId(); firstPattern = true; for (var i = 0; i < definedPatterns.length; ++i) { @@ -1825,7 +1973,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { } // Output cycle operation as subprogram - if (!usePattern && (staticProperties.useSubroutines == "cycles") && currentSection.doesStrictCycle && + if (!usePattern && (getProperty("useSubroutines") == "cycles") && currentSection.doesStrictCycle && (currentSection.getNumberOfCycles() == 1) && currentSection.getNumberOfCyclePoints() >= minimumCyclePoints) { var finalPosition = getFramePosition(currentSection.getFinalPosition()); currentPattern = currentSection.getNumberOfCyclePoints(); @@ -1860,7 +2008,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { } // Output each operation as a subprogram - if (!usePattern && (staticProperties.useSubroutines == "allOperations")) { + if (!usePattern && (getProperty("useSubroutines") == "allOperations")) { currentSubprogram = ++lastSubprogram; writeBlock(mFormat.format(97), "P" + nFormat.format(currentSubprogram)); firstPattern = true; @@ -1894,7 +2042,7 @@ function subprogramEnd() { } forceAny(); firstPattern = false; - staticProperties.showSequenceNumbers = saveshowSequenceNumbers; + staticProperties.showSequenceNumbers = saveShowSequenceNumbers; closeRedirection(); } @@ -1998,6 +2146,32 @@ function setAbsoluteMode(xyz, abc) { } function onSection() { + // 07/06/21 | Gavin Williams | will1742 + // 002 Improved Probing + // uses pencil to verify WCS, prompts user + 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 + + writeBlock(gFormat.format(0), xOutput.format(stockMidX), yOutput.format(stockMidY)); + 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']); + 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']); + writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); + } + + var forceToolAndRetract = optionalSection && !currentSection.isOptional(); optionalSection = currentSection.isOptional(); @@ -2094,11 +2268,6 @@ function onSection() { writeRetract(Z); } } - - // 6/18/21 | Gavin Williams | will1742 - // Terminate any media that may have been active at beginning of section - // Issue 001: Input and validation - writeBlock(mFormat.format(131), formatComment("End multimedia")); if (insertToolCall || operationNeedsSafeStart) { @@ -2310,10 +2479,9 @@ function onSection() { // writeComment("PREPOSITIONING END"); skipBlock = _skipBlock; writeBlock( - gMotionModal.format(G), - conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), - conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), - xOutput.format(initialPosition.x), yOutput.format(initialPosition.y), zOutput.format(initialPosition.z), F, + gMotionModal.format(0), // G0 motion mode is required for the G234 command + gFormat.format(234), + xOutput.format(initialPosition.x), yOutput.format(initialPosition.y), zOutput.format(initialPosition.z), hFormat.format(lengthOffset) ); } else { @@ -2332,7 +2500,7 @@ function onSection() { skipBlock = _skipBlock; writeBlock( gAbsIncModal.format(90), - gMotionModal.format(G), + gMotionModal.format(currentSection.isMultiAxis() && tcpIsSupported ? 0 : G), conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), xOutput.format(initialPosition.x), @@ -2355,7 +2523,9 @@ function onSection() { writeBlock(gAbsIncModal.format(90), gMotionModal.format(0), x, y); } } - + if (gMotionModal.getCurrent() == 0) { + forceFeed(); + } gMotionModal.reset(); } else { validate(lengthCompensationActive, "Length compensation is not active."); @@ -2405,34 +2575,47 @@ function onSection() { } } - writeComment("BEGIN VALIDATION SECTION"); - // Added 06/15/21 | Gavin Williams | will1742 - // Verifies tool-stock distance. Post fails if tool fails clearance standards - if (toolDistance < 1) { - throw "Error: Clearance height must be greater than 1 inch from stock"; - } + if (getProperty("toolHeightValidation")) { + writeComment("BEGIN VALIDATION SECTION"); + // Added 06/15/21 | Gavin Williams | will1742 + // Verifies tool-stock distance. Post fails if tool fails clearance standards + if (toolDistance < 1) { + throw "Error: Clearance height must be greater than 1 inch from stock"; + } - if (toolDistance == Infinity) { - throw "Error: invalid tool distance. Contact a TA."; - } - var toolDistance = initialPosition.z - stockTopZ; + if (toolDistance == Infinity) { + throw "Error: invalid tool distance. Contact a TA."; + } + var toolDistance = initialPosition.z - stockTopZ; + + // Prompt user to check stock-tool distance + displayMedia("Net Share/Media/checkDistance.png"); + writeBlock(mFormat.format(0), formatComment("Open door")); + displayMedia("Net Share/Media/arrowDown.png"); - // Prompt user to check stock-tool distance - displayMedia("Net Share/Media/checkDistance.png"); - writeBlock(mFormat.format(0), formatComment("Open door")); - displayMedia("Net Share/Media/arrowDown.png"); + // asks user if measured height is accurate to displayed + var gotoRef = takeInput(("Is the tool " + toolDistance.toPrecision(3) + "in from the stock? [Y/N]"), ['N', 'Y']); - // asks user if measured height is accurate to displayed - var gotoRef = takeInput(("Is the tool " + toolDistance.toPrecision(3) + "in from the stock? [Y/N]"), ['N', 'Y']); + // Create GOTO cases for Y/N selection, halt if N + getTA("Net Share/Media/TAWarning.png", gotoRef['N'], onSecGotoRef); + writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); + writeWords( + conditional(!currentSection.isMultiAxis() || !tcpIsSupported, gFormat.format(43)), + conditional(currentSection.isMultiAxis() && tcpIsSupported, gFormat.format(234)), + zOutput.format(initialPosition.z), + hFormat.format(lengthOffset) + ); + writeComment("END VALIDATION SECTION"); - // Create GOTO cases for Y/N selection, halt if N - getTA("Net Share/Media/TAWarning.png", gotoRef['N'], onSecGotoRef); - writeWords("N" + nFormat.format(gotoRef['Y']), mFormat.format(131), formatComment("End Multimedia")); - writeComment("END VALIDATION SECTION"); + // initialize spindle and engage coolant if heights are correct + if (tool.type != TOOL_PROBE) { + writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); + } + } - // initialize spindle and engage coolant if heights are correct - writeBlock(mFormat.format((tool.clockwise ? 3 : 4)), formatComment("Restart spindle")); - setCoolant(tool.coolant); + if (tool.type != TOOL_PROBE) { + setCoolant(tool.coolant); + } // define subprogram subprogramDefine(initialPosition, abc, retracted, zIsOutput); @@ -2461,7 +2644,7 @@ function takeInput(prompt, options) { if (macroNumber > 549) macroNumber = 500; // init macro var to 0 - writeWords("#" + macroNumber + "=0", formatComment("Initialize macro variable")); + setMacro(macroNumber, 0, "Initialize macro variable"); // disply prompt and save response writeBlock(mFormat.format(109), "P" + nFormat.format(macroNumber), formatComment(prompt)); @@ -2497,13 +2680,14 @@ function takeInput(prompt, options) { // Added 06/15/21 | Gavin Williamas | will1742 // Issue 001 Input and validation -// Halts program until TA arrives. Returns to beginning of onSection +// Halts program until TA arrives. Jumps to gotoRef function getTA(file, seqNum, gotoRef) { writeWords("N" + nFormat.format(seqNum), gFormat.format(53), gFormat.format(0), zOutput.format(0.), formatComment("Retract spindle")); writeWords(mFormat.format(130), formatComment(file)); writeWords(mFormat.format(0), formatComment("Halt Program")); + writeWords(mFormat.format(131)); writeWords("GOTO" + nFormat.format(gotoRef), formatComment("Return to beginning of operation")); } @@ -3347,7 +3531,6 @@ function onRadiusCompensation() { pendingRadiusCompensation = radiusCompensation; } -var forceG0 = false; function onRapid(_x, _y, _z) { var x = xOutput.format(_x); var y = yOutput.format(_y); @@ -3357,14 +3540,13 @@ function onRapid(_x, _y, _z) { error(localize("Radius compensation mode cannot be changed at rapid traversal.")); return; } - if (!staticProperties.useG0 && !forceG0 && (((x ? 1 : 0) + (y ? 1 : 0) + (z ? 1 : 0)) > 1)) { + if (!staticProperties.useG0 && (((x ? 1 : 0) + (y ? 1 : 0) + (z ? 1 : 0)) > 1)) { // axes are not synchronized writeBlock(gFeedModeModal.format(94), gMotionModal.format(1), x, y, z, getFeed(toPreciseUnit(highFeedrate, MM))); } else { writeBlock(gMotionModal.format(0), x, y, z); forceFeed(); } - forceG0 = false; } } @@ -3410,6 +3592,7 @@ function onLinear(_x, _y, _z, feed) { } } +var forceG0 = false; function onRapid5D(_x, _y, _z, _a, _b, _c) { if (!currentSection.isOptimizedForMachine()) { error(localize("This post configuration has not been customized for 5-axis simultaneous toolpath.")); @@ -3428,7 +3611,8 @@ function onRapid5D(_x, _y, _z, _a, _b, _c) { ((bOutput.isEnabled() && abcFormat.areDifferent(_b, bOutput.getCurrent())) ? 1 : 0) + ((cOutput.isEnabled() && abcFormat.areDifferent(_c, cOutput.getCurrent())) ? 1 : 0); if (!staticProperties.useG0 && !forceG0 && (tcpIsSupported || (num > 1))) { - invokeOnLinear5D(_x, _y, _z, _a, _b, _c, toPreciseUnit(highFeedrate, MM)); // onLinear5D handles inverse time feedrates + invokeOnLinear5D(_x, _y, _z, _a, _b, _c, highFeedrate); // onLinear5D handles inverse time feedrates + forceG0 = false; return; } @@ -3530,7 +3714,8 @@ function onRotateAxes(_x, _y, _z, _a, _b, _c) { function onReturnFromSafeRetractPosition(_x, _y, _z) { // reinstate TCP if (tcpIsSupported) { - writeBlock(gFormat.format(234), hFormat.format(tool.lengthOffset), formatComment("TCPC ON")); + writeBlock(gMotionModal.format(0), gFormat.format(234), hFormat.format(tool.lengthOffset), formatComment("TCPC ON")); + forceFeed(); lengthCompensationActive = true; } @@ -3539,7 +3724,6 @@ function onReturnFromSafeRetractPosition(_x, _y, _z) { xOutput.reset(); yOutput.reset(); zOutput.disable(); - forceG0 = true; invokeOnRapid(_x, _y, _z); // position in Z @@ -4227,6 +4411,7 @@ longDescription = "Generic post for the HAAS Next Generation control with inspec var controlType = "NGC"; // Specifies the control model "NGC" or "Classic" // >>>>> INCLUDED FROM ../common/haas base inspection.cps +/* properties.probeLocalVar = { title: "Local variable start", description: "Specify the starting value for macro # variables that are to be used for calculations during inspection paths.", @@ -4351,6 +4536,23 @@ properties.calibrationNCOutput = { ], value: "none", scope: "post" +};*/ +properties.toolHeightValidation = { + title: "Tool Length Validation", + description: "Length validation. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" +}; + +properties.pencilWCSValidation = { + title: "WCS Validation", + description: "WCS validation. By turning this off, you accept responsibility for any resulting crashes.", + group: 99, + type: "boolean", + value: true, + scope: "post" }; var ijkFormat = createFormat({decimals:5, forceDecimal:true}); @@ -4868,7 +5070,7 @@ function forceSequenceNumbers(force) { if (force) { staticProperties.showSequenceNumbers = true; } else { - staticProperties.showSequenceNumbers = saveshowSequenceNumbers; + staticProperties.showSequenceNumbers = saveShowSequenceNumbers; } }