diff --git a/.gitignore b/.gitignore index e45abea..f94f965 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ Old/haas next generation.cps +*.nc +Haas_Next_Generation/haas next* \ No newline at end of file diff --git a/Haas_Next_Generation/haas vf2.cps b/Haas_Next_Generation/haas vf2.cps index b478f7e..fa150d9 100644 --- a/Haas_Next_Generation/haas vf2.cps +++ b/Haas_Next_Generation/haas vf2.cps @@ -406,9 +406,9 @@ properties = { staticProperties = { machineModel: "none", safePositionMethod: "G53", - hasAAxis: "false", + hasAAxis: "reversed", hasBAxis: "false", - hasCAxis: "false", + hasCAxis: "true", useDPMFeeds: false, useTCPC: true, useDWO: true, @@ -651,7 +651,6 @@ function writeComment(text) { /** Returns the matching HAAS tool type for the tool. */ - function getHaasToolType(toolType) { switch (toolType) { case TOOL_DRILL: @@ -852,7 +851,6 @@ function writeToolMeasureBlock(tool, preMeasure) { ); } else { // use Macro P9995 to measure tools // writeFunction("T" + toolFormat.format(tool.number), mFormat.format(6)); // get tool - // TODO: fix tool type setMacro(1600 + tool.number, tool.numberOfFlutes, "Number of Flutes"); writeFunction( gFormat.format(65), @@ -967,7 +965,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 @@ -991,11 +989,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); } } @@ -1125,9 +1123,10 @@ function onOpen() { if (!staticProperties.separateWordsWithSpace) { setWordSeparator(""); } - saveshowSequenceNumbers = staticProperties.showSequenceNumbers; + saveShowSequenceNumbers = staticProperties.showSequenceNumbers; sequenceNumber = staticProperties.sequenceNumberStart; writeln("%"); + if (programName) { var programId; try { @@ -2046,7 +2045,7 @@ function subprogramEnd() { } forceAny(); firstPattern = false; - staticProperties.showSequenceNumbers = saveshowSequenceNumbers; + staticProperties.showSequenceNumbers = saveShowSequenceNumbers; closeRedirection(); } @@ -2484,10 +2483,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 { @@ -2506,7 +2504,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), @@ -2529,7 +2527,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."); @@ -3524,7 +3524,6 @@ function onRadiusCompensation() { pendingRadiusCompensation = radiusCompensation; } -var forceG0 = false; function onRapid(_x, _y, _z) { var x = xOutput.format(_x); var y = yOutput.format(_y); @@ -3534,14 +3533,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; } } @@ -3587,6 +3585,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.")); @@ -3605,7 +3604,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; } @@ -3707,7 +3707,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; } @@ -3716,7 +3717,6 @@ function onReturnFromSafeRetractPosition(_x, _y, _z) { xOutput.reset(); yOutput.reset(); zOutput.disable(); - forceG0 = true; invokeOnRapid(_x, _y, _z); // position in Z @@ -5045,7 +5045,7 @@ function forceSequenceNumbers(force) { if (force) { staticProperties.showSequenceNumbers = true; } else { - staticProperties.showSequenceNumbers = saveshowSequenceNumbers; + staticProperties.showSequenceNumbers = saveShowSequenceNumbers; } }