You are on page 1of 16

/**

Copyright (C) 2012-2013 by Autodesk, Inc.
All rights reserved.
Selca post processor configuration.
$Revision: 35007 $
$Date: 2013-09-19 16:53:42 +0200 (to, 19 sep 2013) $
FORKID {9F6A96DA-AAF3-4981-83FC-EAA6A4589822}
*/
description = "GitHub - Generic Selca";
vendor = "Autodesk, Inc.";
vendorUrl = "http://www.autodesk.com";
legal = "Copyright (C) 2012-2013 by Autodesk, Inc.";
certificationLevel = 2;
minimumRevision = 24000;
extension = "nc";
setCodePage("ascii");
tolerance = spatial(0.002, MM);
minimumChordLength = spatial(0.01, MM);
minimumCircularRadius = spatial(0.01, MM);
maximumCircularRadius = spatial(1000, MM);
minimumCircularSweep = toRad(0.01);
maximumCircularSweep = toRad(180);
allowHelicalMoves = true;
allowedCircularPlanes = undefined; // allow any circular motion

// user-defined properties
properties = {
writeMachine: true, // write machine
writeTools: true, // writes the tools
preloadTool: true, // preloads next tool on tool change if any
showSequenceNumbers: false, // show sequence numbers
sequenceNumberStart: 10, // first sequence number
sequenceNumberIncrement: 5, // increment for sequence numbers
optionalStop: true, // optional stop
separateWordsWithSpace: true, // specifies that the words should be separated
with a white space
showNotes: false // specifies that operation notes should be output.
};

var permittedCommentChars = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-";
var mapCoolantTable = new Table(
[9, 8, 7],
{initial:COOLANT_OFF, force:true},
"Invalid coolant mode"
);
var gFormat = createFormat({prefix:"G"});
var mFormat = createFormat({prefix:"M"});

abcFormat). abcFormat).var hFormat = createFormat({prefix:"H"}). var rFormat = xyzFormat. . // modal group 1 // G0-G3. cOutput = createVariable({prefix:"C"}.sequenceNumberIncrement. // modal group 3 // G90-91 var gFeedModeModal = createModal({}. gFormat). feedFormat). scale:DEG}).reset(). // modal group 6 // G70-71 var gCycleModal = createModal({}. force:true}. dFormat). force:true}. xyzFormat).. bOutput = createVariable({prefix:"B"}. // seconds .}}. var gPlaneModal = createModal({onchange:function () {gMotionModal. feedOutput = createVariable({prefix:"F"}. var dFormat = createFormat({prefix:"D"}). var gMotionModal = createModal({}.. */ function writeBlock() { if (properties. var toolFormat = createFormat({decimals:0}). // modal group 5 // G93-94 var gUnitModal = createModal({}. } } /** Output a comment. gF ormat). var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4). arguments). // modal group 2 // G17-19 var gAbsIncModal = createModal({}.999 var taperFormat = createFormat({decimals:1. xyzFormat). gFormat). zOutput = createVariable({prefix:"Z"}. gFormat). // modal group 9 // G81. xyzFormat). abcFormat). var feedFormat = createFormat({decimals:(unit == MM ? 0 : 1). var currentWorkOffset. = createVariable({prefix:"J". . // radius var abcFormat = createFormat({decimals:3. var WARNING_WORK_OFFSET = 0. var kFormat = createFormat({decimals:3. force:true}. gFormat). */ function writeComment(text) { . yOutput = createVariable({prefix:"Y"}. forceDecimal:true. forceDecimal:true}). sequenceNumber += properties. forceDecimal:true} ). var rpmFormat = createFormat({decimals:0}). sOutput = createVariable({prefix:"S".showSequenceNumbers) { writeWords2("N" + sequenceNumber.001-99999. xyzFormat). gFormat). var var var var var var var var var xOutput = createVariable({prefix:"X"}. = createVariable({prefix:"K". /** Writes the specified block. dOutput = createVariable({}. // collected state var sequenceNumber..range 0.. xyzFormat). rpmFormat). xyzFormat). // circular var iOutput var jOutput var kOutput output = createVariable({prefix:"I". force:true}. forceDecimal:true}) . scale:DEG}). aOutput = createVariable({prefix:"A"}. } else { writeWords(arguments).

writeTools) { var zRanges = {}. } sequenceNumber = properties. machineConfiguration = new MachineConfiguration(aAxis. table:false. } if (model) { writeComment(" " + localize("model") + ": " + model). axis:[0.separateWordsWithSpace) { setWordSeparator(""). if (vendor) { writeComment(" " + localize("vendor") + ": " + vendor). optimizeMachineAngles2(0). cAxis).360].writeln("[ " + filterText(String(text).getModel(). preference:1}). if (properties.isMachineCoordinate(0)) { aOutput. 0].toUpperCase().getDescription().isMachineCoordinate(2)) { cOutput. 0. permittedCommentChars)).disable(). 1]. if (programName) { writeComment(programName).isMachineCoordinate(1)) { bOutput. } function onOpen() { if (false) { // note: setup your machine here var aAxis = createAxis({coordinate:0. range:[-3 60. } if (!machineConfiguration. preference:1}). } } // dump tool information if (properties. // TCP mode } if (!machineConfiguration.sequenceNumberStart.getVendor(). range:[-3 60. var model = machineConfiguration. if (is3D()) { . } if (!properties.disable().360].writeMachine && (vendor || model || description)) { writeComment(localize("Machine")). var cAxis = createAxis({coordinate:2. } if (!machineConfiguration. } if (programComment) { writeComment(programComment). axis:[1. } // dump machine configuration var vendor = machineConfiguration.disable(). } if (description) { writeComment(" " + localize("description") + ": " + description). setMachineConfiguration(machineConfiguration). table:false. 0. var description = machineConfiguration.

getTool(i).number) + " " + "D=" + xyzFormat.var numberOfSections = getNumberOfSections()." + getToolTypeName(tool. for (var i = 0. writeBlock(gFormat.getTool(). i < tools. writeBlock(gPlaneModal. ++i) { var section = getSection(i).expandToRange(zRange).getMinimum()). } } function onComment(message) { var comments = String(message). if ((tool. var comment = "T" + toolFormat. // absolute centers switch (unit) { case IN: writeBlock(gUnitModal. i < numberOfSections.cornerRadius).getGlobalZRange().format(70)).format(tool. and Z.type).getNumberOfTools().format(tool.number].number].diameter) + " " + localize("CR") + "=" + xyzFormat. for (comment in comments) { writeComment(comments[comment]). } } } var tools = getToolTable(). Y. if (tools.PI)) { comment += " " + localize("TAPER") + "=" + taperFormat. break. break. } if (zRanges[tool.number] = zRange. var tool = section. } else { zRanges[tool.format(90)).format(zRanges[t ool. var zRange = section.reset().tap erAngle) + localize("deg").format(94)). } } } // absolute coordinates and feed per min writeBlock(gAbsIncModal. "K1"). ++i) { var tool = tools. */ function forceXYZ() { xOutput.number]) { zRanges[tool.format(71)).format(62).split(".format(tool.taperAngle < Math. writeBlock(gFeedModeModal. case MM: writeBlock(gUnitModal. } } /** Force output of X.getNumberOfTools() > 0) { for (var i = 0.format(17)).format(tool. .taperAngle > 0) && (tool.number]) { comment += " ."). } comment += " . writeComment(comment). if (zRanges[tool." + localize("ZMIN") + "=" + xyzFormat.

B.areDifferent(abc. and C.yOutput. currentWorkPlaneABC = abc.isMultiAxisConfiguration()) { return. function forceWorkPlane() { currentWorkPlaneABC = undefined. // choose closest machine angles var currentMachineABC. Z. zOutput.x. C. B.x)). currentWorkPlaneABC. } var closestABC = false.reset(). conditional(machineConfiguration.reset().z))) { return. and F on next output. A. "C" + abcFormat. } function setWorkPlane(abc) { if (!machineConfiguration. cOutput. */ function forceAny() { forceXYZ(). currentWorkPlaneABC. feedOutput.for mat(abc. "B" + abcFormat.z)) ). */ function forceABC() { aOutput.format(0).areDifferent(abc.isMachineCoordinate(2). currentWorkPlaneABC. // no change } onCommand(COMMAND_UNLOCK_MULTI_AXIS).reset(). forceABC().y)). } /** Force output of A.reset(). onCommand(COMMAND_LOCK_MULTI_AXIS).for mat(abc. } function onParameter(name. conditional(machineConfiguration.reset().reset(). value) { } var currentWorkPlaneABC = undefined.y. } /** Force output of X.x) || abcFormat. conditional(machineConfiguration.y) || abcFormat. // ignore } if (!((currentWorkPlaneABC == undefined) || abcFormat. Y.for mat(abc. .isMachineCoordinate(0). // NOTE: add retract here writeBlock( gMotionModal.isMachineCoordinate(1).z. bOutput.areDifferent(abc. "A" + abcFormat.

isMachineCoordinate(1).format(abc.x)) + conditional(machineConfiguration. " C" + abcForma t. if (tcp) { setRotation(W).isMachineCoordinate(0). currentMachineABC).format(abc. " A" + abcForma t. " C" + abcForma t.y)) + conditional(machineConfiguration. " B" + abcForma t. } return abc. currentMachineABC = abc.getDirection(abc).remapABC(abc). } if (!machineConfiguration. } try { abc = machineConfiguration.forward)) { error(localize("Orientation not supported. // TCP mode } else { var O = machineConfiguration.format(abc. } function onSection() { var insertToolCall = isFirstSection() || . // map to global frame var abc = machineConfiguration.function getWorkPlaneMachineABC(workPlane) { var W = workPlane. } else { abc = machineConfiguration. } var tcp = true.remapToABC(abc.isMachineCoordinate(2).isMachineCoordinate(2). } catch (e) { error( localize("Machine angles not supported") + ":" + conditional(machineConfiguration.format(abc. " A" + abcForma t. if (!isSameDirection(direction. if (closestABC) { if (currentMachineABC) { abc = machineConfiguration. setRotation(R).getABC(W). " B" + abcForma t.z)) ).format(abc.")).y)) + conditional(machineConfiguration.isABCSupported(abc)) { error( localize("Work plane is not supported") + ":" + conditional(machineConfiguration. var R = machineConfiguration. W.getRemainingOrientation(abc. } var direction = machineConfiguration.format(abc.getPreferredABC(abc).isMachineCoordinate(1).getOrientation(abc).x)) + conditional(machineConfiguration.isMachineCoordinate(0). W).getPreferredABC(abc). } } else { abc = machineConfiguration.z)) ).

workOffset != currentSection. } } if (properties. // work offs et changes var newWorkPlane = isFirstSection() || !isSameDirection(getPreviousSection(). if (notes) { var lines = String(notes). onCommand(COMMAND_COOLANT_OFF). var r1 = new RegExp("^[\\s]+". gAbsIncModal.comment) { writeComment(tool. currentSecti on. if (comment) { writeComment(comment). } if (tool. var retracted = false.number). } writeBlock("T" + toolFormat. } if (hasParameter("operation-comment")) { var comment = getParameter("operation-comment").getTool().format(91).currentSection.reset(). "").showNotes && hasParameter("notes")) { var notes = getParameter("notes").getForceToolChange && currentSection. var r2 = new RegExp("[\\s]+$". zOutput. // retract // writeBlock(gAbsIncModal. // writeBlock(gFormat. if (tool. .")).getGlobalInitialToolAxis()).getGlobalFinalToolAxis().format(90)). } } } } if (insertToolCall) { forceWorkPlane(). "g").format(6)). mFormat.comment).replace(r2.f ormat(0)).number). retracted = true.replace(r1.format(tool. for (line in lines) { var comment = lines[line].format(28).getForceToolChange() || (tool. if (insertToolCall || newWorkOffset || newWorkPlane) { // retract to safe plane // retracted = true.optionalStop) { onCommand(COMMAND_OPTIONAL_STOP).split("\n"). if (!isFirstSection() && properties.number > 99) { warning(localize("Tool number exceeds maximum value. if (comment) { writeComment(comment). "Z" + xyzFormat. // specifies that the tool has been retracted to the sa fe plane var newWorkOffset = isFirstSection() || (getPreviousSection().workOffset).number != getPreviousSection(). ""). "g").

number. if (tool. Using G54 as WCS.format(nextTool.spindleRPM. if (workOffset == 0) { warningOnce(localize("Work offset has not been specified. var firstToolNumber = section.getTool(). if (showToolZMin) { if (is3D()) { var numberOfSections = getNumberOfSections().clockwise != getPreviousSection().c lockwise ? 3 : 4) ).getGlobalZRange().getTool(). } writeBlock( gFormat. var number = tool.clockwise)) { if (tool. if (nextTool) { writeBlock("T" + toolFormat. WARNING_WORK_OFFSET). } zRange.format(97).getTool().getCurrent())) || (tool.getId() + 1.spindleRPM).number)). } if (workOffset > 0) { if (workOffset > 99) { error(localize("Work offset out of range.")). sOutput. } writeComment(localize("ZMIN") + "=" + zRange.number != number) { break. if (section." ).getGlobalZRange()).number != firstToolNumber) { writeBlock("T" + toolFormat. sOutput. } if (tool.preloadTool) { var nextTool = getNextTool(tool.number). for (var i = currentSection. } } } } if (insertToolCall || isFirstSection() || (rpmFormat.expandToRange(section.workOffset. } } if (properties.} var showToolZMin = false.spindleRPM > 99999) { warning(localize("Spindle speed exceeds maximum value.format(tool.")). var zRange = currentSection.getMinimum()). } else { . mFormat.format(tool.areDifferent(tool.spindleRPM < 1) { error(localize("Spindle speed out of range.")). ++i) { var section = getSection(i).format(firstToolNumber)). } // wcs var workOffset = currentSection. } else { // preload first tool var section = getSection(0). i < numberOfSections.number. workOffset = 1.

format(17)).lengthOffset. } setRotation(remaining).reset(). gMotionModal. if (!isSameDirection(remaining. 0. } } forceAny(). .lookup(tool. return. if (machineConfiguration.format(c)). } else { warning(localize("Coolant not supported. 0. writeBlock(gPlaneModal.reset(). } } } forceXYZ().workPlane). currentWorkOffset = workOffset. zOutput.z) { writeBlock(gMotionModal. if (!retracted) { if (getCurrentPosition(). new Vector(0. var initialPosition = getFramePosition(currentSection.")). if (currentSection. } setWorkPlane(abc). } else { abc = getWorkPlaneMachineABC(currentSection. } else { // pure 3D var remaining = currentSection. 0). if (c) { writeBlock(mFormat.format(0). if (insertToolCall) { var lengthOffset = tool.isMultiAxis()) { forceWorkPlane(). } // set coolant after we have positioned at Z { var c = mapCoolantTable. if (lengthOffset > 9999) { error(localize("Length offset out of range. return.z)).z < initialPosition.format(initialPosition.coolant).getInitialPosition()). cancelTransformation(). 1))) { error(localize("Tool orientation is not supported.")).")).isMultiAxisConfiguration()) { // use 5-axis indexing for multi-axis mode // set working plane after datum shift var abc = new Vector(0.forward. } gMotionModal.workPlane. } } writeBlock(gAbsIncModal.if (workOffset != currentWorkOffset) { writeBlock("O" + workOffset).format(90)).

z).format(y). } else { writeBlock( gMotionModal.format(lengthOffset) ). hFor mat.format(90)). } function onSpindleSpeed(spindleSpeed) { writeBlock(sOutput. xOutput.if (!machineConfiguration.y) ). xOutput. switch (cycleType) { case "drilling": writeBlock( . } gMotionModal.format(r)].format(17)). } function getCommonCycle(x. y.x). writeBlock(gFormat.dwell * 10. z) { if (isFirstCyclePoint()) { repositionToCycleClearance(cycle. } else { writeBlock( gMotionModal.format(0). z.format(initialPosition.format(0). var F = cycle. cycle. r) { forceXYZ(). } } function onDwell(seconds) { if (seconds > 99999.x).format(4).format(z).forma t(initialPosition. zOutput.format(initialPosition.999) { warning(localize("Dwelling time is out of range. "J" + xyzFormat.format(x). y. yOutput. x.format(spindleSpeed)).y). // return to initial Z which is clearance plane and set absolute mode writeBlock(gAbsIncModal. y. yOutput.isHeadConfiguration()) { writeBlock( gMotionModal.")). var K = (cycle.format(initialPosition.format(initialPosition.x).dwell == 0) ? 0 : clamp(0.format(initialPosition. } function onCycle() { writeBlock(gPlaneModal. seconds * 1000. zOutput. } function onCyclePoint(x.001.format(seconds * 10)).feedrate. "K" + kFormat. hFormat. return [xOutput.y) ).format(lengthOffset)).reset().format(initialPosition. writeBlock(gMotionModal. z).z). yOutput. 99999.format(0).999). yOutput. } milliseconds = clamp(1. zOutput. xOutput.format(0).format(initialPosition. 99999999).

"K" + kFormat.incrementalDepth). case "tapping": case "left-tapping": case "right-tapping": if (!F) { F = tool. conditional(K > 0. cycle.retract).retract). break. "I" + xyzFormat.format(cycle. z). conditional(K > 0. "K" + kFormat. "Q" + xyzFormat. break. conditional(K > 0. getCommonCycle(x.format(F) ). cycle. y. // optional feedOutput. y. y.format(K)).format(K)). conditional(K > 0. z.gCycleModal. case "reaming": writeBlock( gCycleModal.format(73). case "stop-boring": . // optional feedOutput.format(K)).retract). z. feedOutput. y.format(F) ). "K" + kFormat. getCommonCycle(x. "K" + kFormat.retract).format(K)). // optional feedOutput.accumulatedDepth is ignored if (K > 0) { expandCyclePoint(x. getCommonCycle(x.format(83).format(F) ). feedOutput.retract).format(cycle. z. } else { writeBlock( gCycleModal. } break. cycle. z. // optional feedOutput. break. */ case "deep-drilling": writeBlock( gCycleModal.format(81).format(81). y. cycle. y.incrementalDepth). z.format(F) ).type == TOOL_TAP_LEFT_HAND) ? 74 : 84). } // F is in um per rev writeBlock( gCycleModal. getCommonCycle(x. cycle. y.format((tool. /* case "chip-breaking": // cycle. break. getCommonCycle(x. break.format(F) ).format(85). cycle. getCommonCycle(x.format(F) ). z.retract). case "counter-boring": writeBlock( gCycleModal.getTappingFeedrate().

format(0). "K" + kFormat.retract). _z. x.format(80)).format(_z). function onRadiusCompensation() { pendingRadiusCompensation = radiusCompensation. case "tapping-with-chip-breaking": case "left-tapping-with-chip-breaking": case "right-tapping-with-chip-breaking": case "boring": case "fine-boring": case "back-boring": case "manual-boring": default: expandCyclePoint(x. zOutput. var y = yOutput. _y. var f = feedOutput.format(K)).format(86). conditional(K > 0. z).format(feed). } function onRapid(_x.format(F) ). feedOutput. _y. z. var y = yOutput. break. } } function onLinear(_x. y. } else { writeBlock(xOutput. yOutput.format(_x).reset(). var z = zOutput. y. cycle. getCommonCycle(x. // optional feedOutput. if (x || y || z) { if (pendingRadiusCompensation >= 0) { error(localize("Radius compensation mode cannot be changed at rapid traver sal. } gMotionModal.reset().")). writeBlock(gMotionModal. } } var pendingRadiusCompensation = -1.format(_x). z). } } else { if (cycleExpanded) { expandCyclePoint(x. feed) { var x = xOutput.format(_y).reset(). } } } function onCycleEnd() { if (!cycleExpanded) { writeBlock(gCycleModal. _z) { var x = xOutput.writeBlock( gCycleModal. var z = zOutput. if (x || y || z) { .format(_y). z).format(y)). y.format(_z). y.format(x).

format(feed). f).format(49).format(_c).if (pendingRadiusCompensation >= 0) { pendingRadiusCompensation = -1. var b = bOutput. feedOutput.format(1). var d = tool. } } } function onRapid5D(_x. switch (radiusCompensation) { case RADIUS_COMPENSATION_LEFT: writeBlock(gFormat.isMotion()) { // try not to output feed without motion feedOutput. var f = feedOutput.reset().")).format(_z). a. _y. var y = yOutput.diameterOffset. f). f).format(_x).format(_y).format(_a). writeBlock(gMotionModal.format(_c). _z.format(1). b.format(d)). y.format(41). gFormat. var b = bOutput.format(40). y.format(_x). z. gFormat. y. _b. // force feed on next line } else { writeBlock(gMotionModal. if (d > 9999) { warning(localize("The diameter offset exceeds the maximum value.format(0). f). var a = aOutput. y. z. case RADIUS_COMPENSATION_RIGHT: writeBlock(gFormat. _c.")). gMotionModal. } writeBlock(gPlaneModal.format(42). break.format(49). c). x. return. x. x.format(_z). } var x = xOutput. var z = zOutput.format(_b). writeBlock(gMotionModal. default: writeBlock(gMotionModal.format(_a). "K" + dFormat. z. var c = cOutput. var a = aOutput. _y.format(d)).format(1). var y = yOutput. "K" + dFormat. } } else { writeBlock(gMotionModal.")).format(1).format(17)). y. var c = cOutput. z. gFormat. } var x = xOutput. feed) { if (pendingRadiusCompensation >= 0) { error(localize("Radius compensation cannot be activated/deactivated for 5-ax is move. writeBlock(gMotionModal.reset().format(1). _a. _z. var z = zOutput. break. z. } } else if (f) { if (getNextRecord().reset().format(_y). f). . _c) { if (pendingRadiusCompensation >= 0) { error(localize("Radius compensation mode cannot be changed at rapid traversa l. _b. x.format(_b). _a. x. } function onLinear5D(_x.

if (isFullCircle()) { if (isHelical()) { // radius mode does not support full arcs linearize(tolerance).format(x).format(17)). xOutput. feedOutput. x. iOutput. } switch (getCircularPlane()) { case PLANE_XY: writeBlock(gPlaneModal.format(clockwise ? 2 : 3).format(cz).format(cy).format(feed)). zOutput. kOu tput.format(1). iOutput.format(cx). y. jOutput. zOutput. z.format(cx).isMotion()) { // try not to output feed without motion feedOutput. case PLANE_YZ: writeBlock(gPlaneModal. jOu tput.format(17)).format(cy). f). } writeBlock(gAbsIncModal. iOutput. return. writeBlock(gMotionModal. z. } } } function onCircular(clockwise. case PLANE_ZX: if (isHelical()) { . y. f).format(clockwise ? 2 : 3). } else { writeBlock(gMotionModal. feedOutput.format(18)).format(getHelicalPitch()).format(y).format(feed)).format(feed)).format(z). writeBlock(gMotionModal. break.format(x). iOutput.")). feed Output.format(cy).format(clockwise ? 2 : 3).format(clockwise ? 2 : 3). case PLANE_ZX: writeBlock(gPlaneModal. } } else { switch (getCircularPlane()) { case PLANE_XY: writeBlock(gPlaneModal. return.format(cy). yO utput. x. cy.format(19)).reset(). if (isHelical()) { writeBlock(gMotionModal. writeBlock(gMotionModal. feedOutput. break.format(1). yO utput. cx. "Z" + xyzFormat.format(feed)). cz.format(cx). feedOutput.format(clockwise ? 2 : 3). jOutput.format(y). default: linearize(tolerance). c.format(feed)). jOutput. feed) { if (pendingRadiusCompensation >= 0) { error(localize("Radius compensation cannot be activated/deactivated for a ci rcular move. xOutput. b. kOu tput. } break.format(90)).format(cz). } else if (f) { if (getNextRecord().format(z).format(cx). a.if (x || y || z || a || b || c) { writeBlock(gMotionModal. // force feed on next line } else { writeBlock(gMotionModal. break.

var mcode = mapCommand[stringId]. jOutput. iOutput.format(cz).linearize(tolerance). COMMAND_ORIENTATE_SPINDLE:19.format(10)). zOutput.format(19)).format(y). } else { . case COMMAND_TOOL_MEASURE: return. return. COMMAND_SPINDLE_COUNTERCLOCKWISE:4. COMMAND_COOLANT_OFF:9 }. yOut put. function onCommand(command) { switch (command) { case COMMAND_START_SPINDLE: onCommand(tool.format(18)).format(clockwise ? 2 : 3). return. default: linearize(tolerance).format(z).format(clockwise ? 2 : 3). writeBlock(gMotionModal. return.format(cx). kOutput. break.clockwise ? COMMAND_SPINDLE_CLOCKWISE : COMMAND_SPINDLE_COUNT ERCLOCKWISE).format(x). return.format(z). yOut put. COMMAND_LOAD_TOOL:6.format(feed)). COMMAND_SPINDLE_CLOCKWISE:3. zOutput. COMMAND_END:2. case COMMAND_LOCK_MULTI_AXIS: writeBlock(mFormat. xOutput. xOutput. writeBlock(gMotionModal.format(x). COMMAND_COOLANT_ON:8.format(11)). case COMMAND_BREAK_CONTROL: return. if (mcode != undefined) { writeBlock(mFormat.format(cy). return. } } } var mapCommand = { COMMAND_STOP:0. kOutput. } writeBlock(gPlaneModal. COMMAND_OPTIONAL_STOP:1.format(feed)). feedOu tput. case COMMAND_UNLOCK_MULTI_AXIS: writeBlock(mFormat.format(mcode)). break.format(y). feedOu tput. } var stringId = getCommandStringId(command). COMMAND_STOP_SPINDLE:5.format(cz). } writeBlock(gPlaneModal. case PLANE_YZ: if (isHelical()) { linearize(tolerance).

} } function onSectionEnd() { if (currentSection.hasHomeP ositionY()) { // 90/91 mode is don't care writeBlock(gFormat. gAbsIncModal.format(28).format(91). if (machineConfiguration.hasHomePositionX() && !machineConfiguration.hasHomePositionX()) { homeX = "X" + xyzFormat. } function onClose() { onCommand(COMMAND_COOLANT_OFF).format(0)). writeBlock(mFormat. // writeBlock(gFormat. if (machineConfiguration. } writeBlock(gPlaneModal.hasHomePositionY()) { homeY = "Y" + xyzFormat. onImpliedCommand(COMMAND_STOP_SPINDLE).format(30)). } */ onImpliedCommand(COMMAND_END).onUnsupportedCommand(command). coolant off } .format(machineConfiguration. "Z" + xyzFormat. forceAny(). // retract // zOutput.reset().form at(0).isMultiAxis()) { writeBlock(gMotionModal.format(91). homeX. homeY).format(53). setWorkPlane(new Vector(0. gAbsIncModal. // stop program. "X" + xyzFormat. } writeBlock(gFormat. } var homeY.format(28).getHomePositionX()).getHomePositionY()). // reset working plane /* if (!machineConfiguration.format(0). spindle stop. // return to home } else { var homeX. gMotionModal.format(machineConfiguration. "Y" + xyzFormat.format(49)).for mat(0)). 0)). 0.format(17)).