From a556a8d324880660ac3485f1679ac7cb961e66ce Mon Sep 17 00:00:00 2001 From: will1742 Date: Sun, 20 Jun 2021 14:54:05 -0400 Subject: [PATCH] Fixed settings and QA features --- Haas_Next_Generation/haas vf2.cps | 267 +++++++++++++++++------------- 1 file changed, 155 insertions(+), 112 deletions(-) diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index fb25d02..f5d022f 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -54,6 +54,7 @@ allowSpiralMoves = true; highFeedrate = 650 * 25.4; // must be in MM // user-defined properties +/* properties = { machineModel: { title: "Machine model", @@ -146,7 +147,7 @@ properties = { description: "Enable to turn on chip transport at start of program.", group: 2, type: "boolean", - value: false, + value: true, scope: "post" }, optionalStop: { @@ -178,7 +179,7 @@ properties = { description: "Parametric feed values based on movement type are output.", group: 2, type: "boolean", - value: false, + value: true, scope: "post" }, useG0: { @@ -186,7 +187,7 @@ properties = { description: "Specifies that G0s should be used for rapid moves when moving along a single axis.", group: 2, type: "boolean", - value: false, + value: true, scope: "post" }, safePositionMethod: { @@ -254,7 +255,7 @@ properties = { description: "Write optional blocks at the beginning of all operations that include all commands to start program.", group: 2, type: "boolean", - value: false, + value: true, scope: "post" }, fastToolChange: { @@ -292,7 +293,7 @@ properties = { {title: "Patterns", id: "patterns"} ], group: 3, - value: "none", + value: "allOperations", scope: "post" }, writeMachine: { @@ -356,7 +357,7 @@ properties = { description: "Enable to output notes for operations.", group: 4, type: "boolean", - value: false, + value: true, scope: "post" }, useM130PartImages: { @@ -398,6 +399,7 @@ properties = { scope: "post" } }; +*/ var singleLineCoolant = false; // specifies to output multiple coolant codes in one line rather than in separate lines // samples: @@ -415,6 +417,48 @@ var coolants = [ {id: COOLANT_OFF, off: 9} ]; +staticProperties = { +// TODO convert to single var + machineModel: "none", + safePositionMethod: "G53", + hasAAxis: "false", + hasBAxis: "false", + hasCAxis: "false", + useDPMFeeds: false, + useTCPC: true, + useDWO: true, + safeStartAllOperations: true, + preloadTool: true, + chipTransport: true, + optionalStop: true, + separateWordsWithSpace: true, + u1eRadius: false, + useParametricFeed: true, + useG0: true, + useG187: false, + homePositionCenter: false, + optionallyCycleToolsAtStart: false, + optionallyMeasureToolsAtStart: false, + forceHomeOnIndexing: true, + toolBreakageTolerance: 0.1, + fastToolChange: false, + useG95forTapping: false, + safeRetractDistance: 0, + useSubroutines: "allOperations", //allOperations + writeMachine: false, + writeTools: true, + writeVersion: false, + showSequenceNumbers: true, + sequenceNumberStart: 10, + sequenceNumberIncrement: 5, + sequenceNumberOnlyOnToolChange: false, + showNotes: true, + useM130PartImages: false, + useM130ToolImages: false, + coolantPressure: "", + singleResultsFile: true +}; + // old machines only support 4 digits var oFormat = createFormat({width:5, zeropad:true, decimals:0}); var nFormat = createFormat({decimals:0}); @@ -533,11 +577,11 @@ function writeBlock() { if (!text) { return; } - var maximumSequenceNumber = ((getProperty("useSubroutines") == "allOperations") || (getProperty("useSubroutines") == "patterns") || - (getProperty("useSubroutines") == "cycles")) ? initialSubprogramNumber : 99999; - if (getProperty("showSequenceNumbers")) { + var maximumSequenceNumber = ((staticProperties.useSubroutines == "allOperations") || (staticProperties.useSubroutines == "patterns") || + (staticProperties.useSubroutines == "cycles")) ? initialSubprogramNumber : 99999; + if (staticProperties.showSequenceNumbers) { if (sequenceNumber >= maximumSequenceNumber) { - sequenceNumber = getProperty("sequenceNumberStart"); + sequenceNumber = staticProperties.sequenceNumberStart; } if (optionalSection || skipBlock) { if (text) { @@ -546,7 +590,7 @@ function writeBlock() { } else { writeWords2("N" + sequenceNumber, arguments); } - sequenceNumber += getProperty("sequenceNumberIncrement"); + sequenceNumber += staticProperties.sequenceNumberIncrement; } else { if (optionalSection || skipBlock) { writeWords2("/", arguments); @@ -561,10 +605,10 @@ function writeBlock() { Writes the specified block - used for tool changes only. */ function writeToolBlock() { - var show = getProperty("showSequenceNumbers"); - setProperty("showSequenceNumbers", show || getProperty("sequenceNumberOnlyOnToolChange")); + var show = staticProperties.showSequenceNumbers; + staticProperties.showSequenceNumbers = (show || staticProperties.sequenceNumberOnlyOnToolChange); writeBlock(arguments); - setProperty("showSequenceNumbers", show); + staticProperties.showSequenceNumbers = show; } /** @@ -702,8 +746,8 @@ function writeToolMeasureBlock(tool, preMeasure) { } function defineMachineModel() { - var useTCPC = getProperty("useTCPC"); - switch (getProperty("machineModel")) { + var useTCPC = staticProperties.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}); var axis2 = createAxis({coordinate:2, table:true, axis:[0, 0, 1], cyclic:true, preference:0, reset:1, tcp:useTCPC}); @@ -741,7 +785,7 @@ function defineMachineModel() { maximumSpindleRPM = 7500; break; } - machineConfiguration.setModel(getProperty("machineModel").toUpperCase()); + machineConfiguration.setModel(staticProperties.machineModel.toUpperCase()); machineConfiguration.setVendor("Haas Automation"); setMachineConfiguration(machineConfiguration); @@ -790,7 +834,7 @@ function activateMachine() { } // retract/reconfigure - safeRetractDistance = getProperty("safeRetractDistance") != undefined ? getProperty("safeRetractDistance") : + safeRetractDistance = staticProperties.singleResultsFile != undefined ? staticProperties.singleResultsFile : (typeof safeRetractDistance == "number" ? safeRetractDistance : 0); if (machineConfiguration.performRewinds() || (typeof performRewinds == "undefined" ? false : performRewinds)) { machineConfiguration.enableMachineRewinds(); // enables the rewind/reconfigure logic @@ -827,7 +871,7 @@ function setFeedrateMode(reset) { return; } machineConfiguration.setMultiAxisFeedrate( - tcpIsSupported ? FEED_FPM : getProperty("useDPMFeeds") ? FEED_DPM : FEED_INVERSE_TIME, + tcpIsSupported ? FEED_FPM : staticProperties.useDPMFeeds ? FEED_DPM : FEED_INVERSE_TIME, 9999.99, // maximum output value for inverse time feed rates INVERSE_MINUTES, // can be INVERSE_SECONDS or DPM_COMBINATION for DPM feeds 0.5, // tolerance to determine when the DPM feed has changed @@ -839,28 +883,28 @@ function setFeedrateMode(reset) { } function defineMachine() { - hasA = getProperty("hasAAxis") != "false"; - hasB = getProperty("hasBAxis") != "false"; - hasC = getProperty("hasCAxis") != "false"; + hasA = staticProperties.hasAAxis != "false"; + hasB = staticProperties.hasBAxis != "false"; + hasC = staticProperties.hasCAxis != "false"; if (hasA && hasB && hasC) { error(localize("Only two rotary axes can be active at the same time.")); return; - } else if ((hasA || hasB || hasC) && getProperty("machineModel") != "none") { + } else if ((hasA || hasB || hasC) && staticProperties.machineModel != "none") { error(localize("You can only select either a machine model or use the ABC axis properties.")); return; - } else if (((hasA || hasB || hasC) || getProperty("machineModel") != "none") && (receivedMachineConfiguration && machineConfiguration.isMultiAxisConfiguration())) { + } else if (((hasA || hasB || hasC) || staticProperties.machineModel != "none") && (receivedMachineConfiguration && machineConfiguration.isMultiAxisConfiguration())) { error(localize("You can only select either a machine in the CAM setup or use the properties to define your kinematics.")); return; } - if (getProperty("machineModel") == "none") { + if (staticProperties.machineModel == "none") { if (hasA || hasB || hasC) { // configure machine var aAxis; var bAxis; var cAxis; - var useTCPC = getProperty("useTCPC"); + var useTCPC = staticProperties.useTCPC; if (hasA) { // A Axis - For horizontal machines and trunnions - var dir = getProperty("hasAAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.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; @@ -871,7 +915,7 @@ function defineMachine() { } if (hasB) { // B Axis - For horizontal machines and trunnions - var dir = getProperty("hasBAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.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; @@ -884,7 +928,7 @@ function defineMachine() { } if (hasC) { // C Axis - For trunnions only - var dir = getProperty("hasCAxis") == "reversed" ? -1 : 1; + var dir = staticProperties.hasCAxis == "reversed" ? -1 : 1; cAxis = createAxis({coordinate:2, table:true, axis:[0, 0, dir], cyclic:true, reset:1, tcp:useTCPC}); } @@ -925,17 +969,17 @@ function onOpen() { } activateMachine(); // enable the machine optimizations and settings - if (getProperty("useDPMFeeds")) { + if (staticProperties.useDPMFeeds) { gFeedModeModal.format(94); } - if (getProperty("useRadius")) { + if (staticProperties.useRadius) { maximumCircularSweep = toRad(90); // avoid potential center calculation errors for CNC } - if (getProperty("sequenceNumberOnlyOnToolChange")) { - setProperty("showSequenceNumbers", false); + if (staticProperties.sequenceNumberOnlyOnToolChange) { + staticProperties.showSequenceNumbers = false; } - if (!getProperty("useDWO")) { - useDwoForPositioning = false; + if (!staticProperties.useDWO) { + useDWOForPositioning = false; } gRotationModal.format(69); // Default to G69 Rotation Off @@ -945,13 +989,12 @@ function onOpen() { return; } - if (!getProperty("separateWordsWithSpace")) { + if (!staticProperties.separateWordsWithSpace) { setWordSeparator(""); } - saveShowSequenceNumbers = getProperty("showSequenceNumbers"); - sequenceNumber = getProperty("sequenceNumberStart"); + saveshowSequenceNumbers = staticProperties.showSequenceNumbers; + sequenceNumber = staticProperties.sequenceNumberStart; writeln("%"); - if (programName) { var programId; try { @@ -974,13 +1017,13 @@ function onOpen() { return; } - if (getProperty("useG0")) { + if (staticProperties.useG0) { writeComment(localize("Using G0 which travels along dogleg path.")); } else { writeComment(subst(localize("Using high feed G1 F%1 instead of G0."), feedFormat.format(toPreciseUnit(highFeedrate, MM)))); } - if (getProperty("writeVersion")) { + if (staticProperties.writeVersion) { if ((typeof getHeaderVersion == "function") && getHeaderVersion()) { writeComment(localize("post version") + ": " + getHeaderVersion()); } @@ -994,7 +1037,7 @@ function onOpen() { var model = machineConfiguration.getModel(); var description = machineConfiguration.getDescription(); - if (getProperty("writeMachine") && (vendor || model || description)) { + if (staticProperties.writeMachine && (vendor || model || description)) { writeComment(localize("Machine")); if (vendor) { writeComment(" " + localize("vendor") + ": " + vendor); @@ -1008,7 +1051,7 @@ function onOpen() { } // dump tool information - if (getProperty("writeTools")) { + if (staticProperties.writeTools) { var zRanges = {}; if (is3D()) { var numberOfSections = getNumberOfSections(); @@ -1040,7 +1083,7 @@ function onOpen() { comment += " - " + getToolTypeName(tool.type); writeComment(comment); - if (getProperty("useM130ToolImages")) { + if (staticProperties.useM130PartImages) { var toolRenderer = createToolRenderer(); if (toolRenderer) { toolRenderer.setBackgroundColor(new Color(1, 1, 1)); @@ -1064,7 +1107,7 @@ function onOpen() { } // optionally cycle through all tools - if (getProperty("optionallyCycleToolsAtStart") || getProperty("optionallyMeasureToolsAtStart")) { + if (staticProperties.optionallyCycleToolsAtStart || staticProperties.optionallyMeasureToolsAtStart) { var tools = getToolTable(); if (tools.getNumberOfTools() > 0) { writeln(""); @@ -1072,14 +1115,14 @@ function onOpen() { writeOptionalBlock(mFormat.format(0), formatComment(localize("Read note"))); // wait for operator writeComment(localize("With BLOCK DELETE turned off each tool will cycle through")); writeComment(localize("the spindle to verify that the correct tool is in the tool magazine")); - if (getProperty("optionallyMeasureToolsAtStart")) { + if (staticProperties.optionallyMeasureToolsAtStart) { writeComment(localize("and to automatically measure it")); } writeComment(localize("Once the tools are verified turn BLOCK DELETE on to skip verification")); for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); - if (getProperty("optionallyMeasureToolsAtStart") && (tool.type == TOOL_PROBE)) { + if (staticProperties.optionallyMeasureToolsAtStart && (tool.type == TOOL_PROBE)) { continue; } var comment = "T" + toolFormat.format(tool.number) + " " + @@ -1090,7 +1133,7 @@ function onOpen() { } comment += " - " + getToolTypeName(tool.type); writeComment(comment); - if (getProperty("optionallyMeasureToolsAtStart")) { + if (staticProperties.optionallyMeasureToolsAtStart) { writeToolMeasureBlock(tool, true); } else { writeToolCycleBlock(tool); @@ -1100,7 +1143,7 @@ function onOpen() { writeln(""); } - if (false /*getProperty("useDWO")*/) { + if (false /*useDWO*/) { var failed = false; var dynamicWCSs = {}; for (var i = 0; i < getNumberOfSections(); ++i) { @@ -1176,9 +1219,9 @@ function onOpen() { break; } - coolantPressure = getProperty("coolantPressure"); + coolantPressure = staticProperties.coolantPressure; - if (getProperty("chipTransport")) { + if (staticProperties.chipTransport) { onCommand(COMMAND_START_CHIP_TRANSPORT); } // Probing Surface Inspection @@ -1504,7 +1547,7 @@ function setWorkPlane(abc) { skipBlock = _skipBlock; onCommand(COMMAND_LOCK_MULTI_AXIS); - if (getProperty("useDWO") && + if (staticProperties.useDWO && (abcFormat.isSignificant(abc.x % (Math.PI * 2)) || abcFormat.isSignificant(abc.y % (Math.PI * 2)) || abcFormat.isSignificant(abc.z % (Math.PI * 2)))) { skipBlock = _skipBlock; activeG254 = true; @@ -1686,7 +1729,7 @@ function previewImage() { warning(localize("The image file format " + "\"" + fileExtension + "\"" + " is not supported on HAAS controls.")); } - if (!getProperty("useM130PartImages") || !permittedExtension) { + if (!staticProperties.useM130PartImages || !permittedExtension) { FileSystem.remove(FileSystem.getCombinedPath(FileSystem.getFolderPath(getOutputPath()), images[i])); // remove images.splice([i], 1); // remove from array } @@ -1719,7 +1762,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { // convert patterns into subprograms var usePattern = false; patternIsActive = false; - if (currentSection.isPatterned && currentSection.isPatterned() && (getProperty("useSubroutines") == "patterns")) { + if (currentSection.isPatterned && currentSection.isPatterned() && (staticProperties.useSubroutines == "patterns")) { currentPattern = currentSection.getPatternId(); firstPattern = true; for (var i = 0; i < definedPatterns.length; ++i) { @@ -1767,7 +1810,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { } // Output cycle operation as subprogram - if (!usePattern && (getProperty("useSubroutines") == "cycles") && currentSection.doesStrictCycle && + if (!usePattern && (staticProperties.useSubroutines == "cycles") && currentSection.doesStrictCycle && (currentSection.getNumberOfCycles() == 1) && currentSection.getNumberOfCyclePoints() >= minimumCyclePoints) { var finalPosition = getFramePosition(currentSection.getFinalPosition()); currentPattern = currentSection.getNumberOfCyclePoints(); @@ -1802,7 +1845,7 @@ function subprogramDefine(_initialPosition, _abc, _retracted, _zIsOutput) { } // Output each operation as a subprogram - if (!usePattern && (getProperty("useSubroutines") == "allOperations")) { + if (!usePattern && (staticProperties.useSubroutines == "allOperations")) { currentSubprogram = ++lastSubprogram; writeBlock(mFormat.format(97), "P" + nFormat.format(currentSubprogram)); firstPattern = true; @@ -1820,7 +1863,7 @@ function subprogramStart(_initialPosition, _abc, _incremental) { "N" + nFormat.format(currentSubprogram) + conditional(comment, formatComment(comment.substr(0, maximumLineLength - 2 - 6 - 1))) ); - setProperty("showSequenceNumbers", false); + staticProperties.showSequenceNumbers = false; if (_incremental) { setIncrementalMode(_initialPosition, _abc); } @@ -1836,7 +1879,7 @@ function subprogramEnd() { } forceAny(); firstPattern = false; - setProperty("showSequenceNumbers", saveShowSequenceNumbers); + staticProperties.showSequenceNumbers = saveshowSequenceNumbers; closeRedirection(); } @@ -1960,20 +2003,20 @@ function onSection() { (!getPreviousSection().isMultiAxis() && currentSection.isMultiAxis() || getPreviousSection().isMultiAxis() && !currentSection.isMultiAxis()); // force newWorkPlane between indexing and simultaneous operations - operationNeedsSafeStart = getProperty("safeStartAllOperations") && !isFirstSection(); + operationNeedsSafeStart = staticProperties.safeStartAllOperations && !isFirstSection(); if (insertToolCall || operationNeedsSafeStart) { - if (getProperty("fastToolChange") && !isProbeOperation()) { + if (staticProperties.fastToolChange && !isProbeOperation()) { currentCoolantMode = COOLANT_OFF; } else if (insertToolCall) { // no coolant off command if safe start operation onCommand(COMMAND_COOLANT_OFF); } } - if ((insertToolCall && !getProperty("fastToolChange")) || newWorkOffset || newWorkPlane || toolChecked) { + if ((insertToolCall && !staticProperties.fastToolChange) || newWorkOffset || newWorkPlane || toolChecked) { // stop spindle before retract during tool change - if (insertToolCall && !isFirstSection() && !toolChecked && !getProperty("fastToolChange")) { + if (insertToolCall && !isFirstSection() && !toolChecked && !staticProperties.fastToolChange) { onCommand(COMMAND_STOP_SPINDLE); } @@ -1999,7 +2042,7 @@ function onSection() { writeln(""); } - if (getProperty("showNotes") && hasParameter("notes")) { + if (staticProperties.showNotes && hasParameter("notes")) { var notes = getParameter("notes"); if (notes) { var lines = String(notes).split("\n"); @@ -2033,7 +2076,7 @@ function onSection() { if (operationNeedsSafeStart) { if (!retracted) { - skipBlock = true; + // skipBlock = true; writeRetract(Z); } } @@ -2045,11 +2088,11 @@ function onSection() { if (insertToolCall || operationNeedsSafeStart) { - if (getProperty("useM130ToolImages")) { + if (staticProperties.useM130PartImages) { writeBlock(mFormat.format(130), "(tool" + tool.number + ".png)"); } - if (!isFirstSection() && getProperty("optionalStop") && insertToolCall) { + if (!isFirstSection() && staticProperties.optionalStop && insertToolCall) { onCommand(COMMAND_OPTIONAL_STOP); } @@ -2121,7 +2164,7 @@ function onSection() { if (spindleSpeed > maximumSpindleRPM) { warning(subst(localize("Spindle speed '" + spindleSpeed + " RPM' exceeds maximum value of '%1 RPM."), maximumSpindleRPM)); } - skipBlock = !spindleChanged; + // skipBlock = !spindleChanged; writeBlock( sOutput.format(spindleSpeed), mFormat.format(tool.clockwise ? 3 : 4) ); @@ -2129,7 +2172,7 @@ function onSection() { previewImage(); - if (getProperty("useParametricFeed") && + if (staticProperties.useParametricFeed && hasParameter("operation-strategy") && (getParameter("operation-strategy") != "drill") && // legacy !(currentSection.hasAnyCycle && currentSection.hasAnyCycle())) { @@ -2184,7 +2227,7 @@ function onSection() { if (!retracted) { writeRetract(Z); } - if (getProperty("forceHomeOnIndexing") && machineConfiguration.isMultiAxisConfiguration()) { + if (staticProperties.forceHomeOnIndexing && machineConfiguration.isMultiAxisConfiguration()) { writeRetract(X, Y); } } @@ -2209,12 +2252,12 @@ function onSection() { gMotionModal.reset(); - if (getProperty("useG187")) { + if (staticProperties.useG187) { writeG187(); } - var G = ((highFeedMapping != HIGH_FEED_NO_MAPPING) || !getProperty("useG0")) ? 1 : 0; - var F = ((highFeedMapping != HIGH_FEED_NO_MAPPING) || !getProperty("useG0")) ? getFeed(toPreciseUnit(highFeedrate, MM)) : ""; + var G = ((highFeedMapping != HIGH_FEED_NO_MAPPING) || !staticProperties.useG0) ? 1 : 0; + var F = ((highFeedMapping != HIGH_FEED_NO_MAPPING) || !staticProperties.useG0) ? getFeed(toPreciseUnit(highFeedrate, MM)) : ""; if (insertToolCall || retracted || operationNeedsSafeStart || !lengthCompensationActive || (!isFirstSection() && (currentSection.isMultiAxis() != getPreviousSection().isMultiAxis()))) { var _skipBlock = !(insertToolCall || retracted || @@ -2319,7 +2362,7 @@ function onSection() { validate(lengthCompensationActive, "Length compensation is not active."); if (insertToolCall || operationNeedsSafeStart) { - if (getProperty("preloadTool")) { + if (staticProperties.preloadTool) { var nextTool = getNextTool(tool.number); if (nextTool) { skipBlock = !insertToolCall; @@ -2361,23 +2404,23 @@ function onSection() { } // Prompt user to check stock-tool distance - displayMedia("Net Share/checkDistance.png"); + displayMedia("Net Share/Media/checkDistance.png"); // Allow door to be opened linePrint("M0" + " (Halt program)"); - displayMedia("Net Share/arrowDown.png"); + 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']); // Create GOTO cases for Y/N selection, halt if N - getTA("getTAWarning.png", gotoRef[0][1], onSecGotoRef); + getTA("Net Share/Media/TAWarning.png", gotoRef[0][1], onSecGotoRef); writeComment("END VALIDATION SECTION") - // initialize spindle and engage coolant if heights are correct - writeln("N" + gotoRef[1][1] + " M" + (tool.clockwise ? 3 : 4) + " (Restart spindle)"); - + writeln("N" + gotoRef[1][1] + " M131 (End Multimedia)"); + linePrint("M" + (tool.clockwise ? 3 : 4) + " (Restart spindle)"); + // Modified 06/09/21 | Gavin Williams | will1742 // Issue 000 Init coolant after positioning setCoolant(tool.coolant); @@ -2390,7 +2433,7 @@ function onSection() { // print with sequence number function linePrint(message) { writeln("N" + sequenceNumber + " " + message); - sequenceNumber += getProperty("sequenceNumberIncrement"); + sequenceNumber += staticProperties.sequenceNumberIncrement; } // Added 6/14/21 | Gavin Williams | will1742 @@ -2441,7 +2484,7 @@ function takeInput(prompt, options) { // adjust sequence number if needed for (i = 5; i < gotoInc; i+=5) { - sequenceNumber += getProperty("sequenceNumberIncrement"); + sequenceNumber += staticProperties.sequenceNumberIncrement; } // return to input until valid option is entered @@ -2449,7 +2492,7 @@ function takeInput(prompt, options) { // increase var number, iterate sequence number macroNumber += 1; - sequenceNumber += getProperty("sequenceNumberIncrement"); + sequenceNumber += staticProperties.sequenceNumberIncrement; return gotoMap; } @@ -2617,7 +2660,7 @@ function onCyclePoint(x, y, z) { if (!allowIndexingWCSProbing && currentSection.strategy == "probe") { error(localize("Updating WCS / work offset using probing is only supported by the CNC in the WCS frame.")); return; - } else if (getProperty("useDWO")) { + } else if (staticProperties.useDWO) { error(localize("Your machine does not support the selected probing operation with DWO enabled.")); return; } @@ -2714,8 +2757,8 @@ function onCyclePoint(x, y, z) { break; case "tapping": var tappingFPM = tool.getThreadPitch() * rpmFormat.getResultingValue(spindleSpeed); - F = (getProperty("useG95forTapping") ? tool.getThreadPitch() : tappingFPM); - if (getProperty("useG95forTapping")) { + F = (staticProperties.useG95forTapping ? tool.getThreadPitch() : tappingFPM); + if (staticProperties.useG95forTapping) { writeBlock(gFeedModeModal.format(95)); } writeBlock( @@ -2727,8 +2770,8 @@ function onCyclePoint(x, y, z) { break; case "left-tapping": var tappingFPM = tool.getThreadPitch() * rpmFormat.getResultingValue(spindleSpeed); - F = (getProperty("useG95forTapping") ? tool.getThreadPitch() : tappingFPM); - if (getProperty("useG95forTapping")) { + F = (staticProperties.useG95forTapping ? tool.getThreadPitch() : tappingFPM); + if (staticProperties.useG95forTapping) { writeBlock(gFeedModeModal.format(95)); } writeBlock( @@ -2740,8 +2783,8 @@ function onCyclePoint(x, y, z) { break; case "right-tapping": var tappingFPM = tool.getThreadPitch() * rpmFormat.getResultingValue(spindleSpeed); - F = (getProperty("useG95forTapping") ? tool.getThreadPitch() : tappingFPM); - if (getProperty("useG95forTapping")) { + F = (staticProperties.useG95forTapping ? tool.getThreadPitch() : tappingFPM); + if (staticProperties.useG95forTapping) { writeBlock(gFeedModeModal.format(95)); } writeBlock( @@ -2755,8 +2798,8 @@ function onCyclePoint(x, y, z) { case "left-tapping-with-chip-breaking": case "right-tapping-with-chip-breaking": var tappingFPM = tool.getThreadPitch() * rpmFormat.getResultingValue(spindleSpeed); - F = (getProperty("useG95forTapping") ? tool.getThreadPitch() : tappingFPM); - if (getProperty("useG95forTapping")) { + F = (staticProperties.useG95forTapping ? tool.getThreadPitch() : tappingFPM); + if (staticProperties.useG95forTapping) { writeBlock(gFeedModeModal.format(95)); } // Parameter 57 bit 6, REPT RIG TAP, is set to 1 (On) @@ -3291,7 +3334,7 @@ function onCycleEnd() { cycleSubprogramIsActive = false; } if (!cycleExpanded) { - writeBlock(gCycleModal.format(80), conditional(getProperty("useG95forTapping"), gFeedModeModal.format(94))); + writeBlock(gCycleModal.format(80), conditional(staticProperties.useG95forTapping, gFeedModeModal.format(94))); gMotionModal.reset(); } } @@ -3313,7 +3356,7 @@ function onRapid(_x, _y, _z) { error(localize("Radius compensation mode cannot be changed at rapid traversal.")); return; } - if (!getProperty("useG0") && !forceG0 && (((x ? 1 : 0) + (y ? 1 : 0) + (z ? 1 : 0)) > 1)) { + if (!staticProperties.useG0 && !forceG0 && (((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 { @@ -3383,7 +3426,7 @@ function onRapid5D(_x, _y, _z, _a, _b, _c) { ((aOutput.isEnabled() && abcFormat.areDifferent(_a, aOutput.getCurrent())) ? 1 : 0) + ((bOutput.isEnabled() && abcFormat.areDifferent(_b, bOutput.getCurrent())) ? 1 : 0) + ((cOutput.isEnabled() && abcFormat.areDifferent(_c, cOutput.getCurrent())) ? 1 : 0); - if (!getProperty("useG0") && !forceG0 && (tcpIsSupported || (num > 1))) { + if (!staticProperties.useG0 && !forceG0 && (tcpIsSupported || (num > 1))) { invokeOnLinear5D(_x, _y, _z, _a, _b, _c, toPreciseUnit(highFeedrate, MM)); // onLinear5D handles inverse time feedrates return; } @@ -3441,7 +3484,7 @@ function moveToSafeRetractPosition(isRetracted) { if (!isRetracted) { writeRetract(Z); } - if (getProperty("forceHomeOnIndexing")) { + if (staticProperties.forceHomeOnIndexing) { skipBlock = _skipBlock; writeRetract(X, Y); } @@ -3580,7 +3623,7 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { var start = getCurrentPosition(); if (isFullCircle()) { - if (getProperty("useRadius") || isHelical()) { // radius mode does not support full arcs + if (staticProperties.useRadius || isHelical()) { // radius mode does not support full arcs linearize(tolerance); return; } @@ -3597,7 +3640,7 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) { default: linearize(tolerance); } - } else if (!getProperty("useRadius")) { + } else if (!staticProperties.useRadius) { switch (getCircularPlane()) { case PLANE_XY: writeBlock(gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx - start.x, 0), jOutput.format(cy - start.y, 0), getFeed(feed)); @@ -3673,7 +3716,7 @@ function getCoolantCodes(coolant) { } if (coolant == currentCoolantMode) { if (operationNeedsSafeStart && coolant != COOLANT_OFF && !isSpecialCoolantActive) { - isOptionalCoolant = true; + // isOptionalCoolant = true; } else if (!forceCoolant || coolant == COOLANT_OFF) { return undefined; // coolant is already active } @@ -3794,7 +3837,7 @@ function onCommand(command) { "P" + 9853, "T" + toolFormat.format(tool.number), "B" + xyzFormat.format(0), - "H" + xyzFormat.format(getProperty("toolBreakageTolerance")) + "H" + xyzFormat.format(staticProperties.toolBreakageTolerance) ); toolChecked = true; lengthCompensationActive = false; // macro 9853 cancels tool length compensation @@ -3881,7 +3924,7 @@ function onSectionEnd() { // reset for next section operationNeedsSafeStart = false; - coolantPressure = getProperty("coolantPressure"); + coolantPressure = staticProperties.coolantPressure; cycleReverse = false; setPolarMode(currentSection, false); @@ -3891,7 +3934,7 @@ function onSectionEnd() { function writeRetract() { var words = []; // store all retracted axes in an array var retractAxes = new Array(false, false, false); - var method = getProperty("safePositionMethod"); + var method = staticProperties.safePositionMethod; if (method == "clearanceHeight") { if (!is3D()) { error(localize("Retract option 'Clearance Height' is not supported for multi-axis machining.")); @@ -3980,7 +4023,7 @@ function writeRetract() { var isDPRNTopen = false; function inspectionCreateResultsFileHeader() { if (isDPRNTopen) { - if (!getProperty("singleResultsFile")) { + if (!staticProperties.singleResultsFile) { writeln("DPRNT[END]"); writeBlock("PCLOS"); isDPRNTopen = false; @@ -3996,7 +4039,7 @@ function inspectionCreateResultsFileHeader() { writeBlock("POPEN"); // check for existence of none alphanumeric characters but not spaces var resFile; - if (getProperty("singleResultsFile")) { + if (staticProperties.singleResultsFile) { resFile = getParameter("job-description") + "-RESULTS"; } else { resFile = getParameter("operation-comment") + "-RESULTS"; @@ -4083,7 +4126,7 @@ function onClose() { // retract writeRetract(Z); - if (!getProperty("homePositionCenter") || currentMachineABC.length != 0) { + if (!staticProperties.homePositionCenter || currentMachineABC.length != 0) { writeRetract(X, Y); } @@ -4115,15 +4158,15 @@ function onClose() { conditional(machineConfiguration.isMachineCoordinate(2), "C" + abcFormat.format(0)) ); } - if (getProperty("homePositionCenter")) { - homePositionCenter = getProperty("homePositionCenter"); + if (staticProperties.homePositionCenter) { + homePositionCenter = staticProperties.homePositionCenter; writeRetract(X, Y); } onImpliedCommand(COMMAND_END); onImpliedCommand(COMMAND_STOP_SPINDLE); - if (getProperty("useM130PartImages") || getProperty("useM130ToolImages")) { + if (staticProperties.useM130PartImages || staticProperties.useM130ToolImages) { writeBlock(mFormat.format(131)); } writeBlock(mFormat.format(30)); // stop program, spindle stop, coolant off @@ -4809,20 +4852,20 @@ function inspectionWriteMeasuredData() { function forceSequenceNumbers(force) { if (force) { - setProperty("showSequenceNumbers", true); + staticProperties.showSequenceNumbers = true; } else { - setProperty("showSequenceNumbers", saveShowSequenceNumbers); + staticProperties.showSequenceNumbers = saveshowSequenceNumbers; } } function skipNLines(n) { - return (n * getProperty("sequenceNumberIncrement") + sequenceNumber); + return (n * staticProperties.sequenceNumberIncrement + sequenceNumber); } function inspectionProcessSectionStart() { writeBlock(gFormat.format(103), "P1", formatComment("LOOKAHEAD OFF")); // only write header once if user selects a single results file - if (!isDPRNTopen || !getProperty("singleResultsFile") || (currentSection.workOffset != inspectionVariables.workpieceOffset)) { + if (!isDPRNTopen || !staticProperties.singleResultsFile || (currentSection.workOffset != inspectionVariables.workpieceOffset)) { inspectionCreateResultsFileHeader(); inspectionVariables.workpieceOffset = currentSection.workOffset; } @@ -4895,7 +4938,7 @@ function inspectionProcessSectionEnd() { if (getProperty("commissioningMode")) { if (controlType == "NGC") { forceSequenceNumbers(true); - writeBlock(inspectionVariables.macroVariable1 + " = [#20261 * " + 4 * getProperty("sequenceNumberIncrement") + " + " + skipNLines(2) + "]"); + writeBlock(inspectionVariables.macroVariable1 + " = [#20261 * " + 4 * staticProperties.sequenceNumberIncrement + " + " + skipNLines(2) + "]"); writeBlock("GOTO " + inspectionVariables.macroVariable1); writeBlock(" "); writeBlock("#3006=1" + formatComment("DPRNT LOCATION NOT SET"));