-14 Removals
+14 Additions
/**/**
Copyright (C) 2012-2013 by Autodesk, Inc. Copyright (C) 2012-2013 by Autodesk, Inc.
All rights reserved. All rights reserved.
RepRap post processor configuration. RepRap post processor configuration.
$Revision: -1 $ $Revision: -1 $
$Date: $ $Date: $
FORKID {996580A5-D617-4b85-9DA2-C4EF3CBF92FC} FORKID {996580A5-D617-4b85-9DA2-C4EF3CBF92FC}
*/*/
description = "Marlin V1";description = "Marlin V1";
vendor = "Autodesk, Inc.";vendor = "Autodesk, Inc.";
vendorUrl = "http://www.autodesk.com";vendorUrl = "http://www.autodesk.com";
legal = "Copyright (C) 2012-2013 by Autodesk, Inc.";legal = "Copyright (C) 2012-2013 by Autodesk, Inc.";
certificationLevel = 2;certificationLevel = 2;
minimumRevision = 24000;minimumRevision = 24000;
extension = "gcode";extension = "gcode";
setCodePage("ascii");setCodePage("ascii");
capabilities = CAPABILITY_MILLING;capabilities = CAPABILITY_MILLING;
tolerance = spatial(0.002, MM);tolerance = spatial(0.002, MM);
highFeedrate = (unit == IN) ? 500 : 2000;highFeedrate = (unit == IN) ? 500 : 2000;
// user-defined properties// user-defined properties
properties = {properties = {
writeMachine: true, // write machine writeMachine: true, // write machine
writeTools: true, // writes the tools writeTools: true, // writes the tools
preloadTool: true, // preloads next tool on tool change if any preloadTool: true, // preloads next tool on tool change if any
showSequenceNumbers: true, // show sequence numbers showSequenceNumbers: true, // show sequence numbers
sequenceNumberStart: 10, // first sequence number sequenceNumberStart: 10, // first sequence number
sequenceNumberIncrement: 5, // increment for sequence numbers sequenceNumberIncrement: 5, // increment for sequence numbers
optionalStop: true, // optional stop optionalStop: true, // optional stop
separateWordsWithSpace: true, // specifies that the words should be separated with a white space separateWordsWithSpace: true, // specifies that the words should be separated with a white space
useG0: false // allow G0 when moving along more than one axis useG0: false // allow G0 when moving along more than one axis
};};
var numberOfToolSlots = 9999;var numberOfToolSlots = 9999;
var gFormat = createFormat({prefix:"G", decimals:0});var gFormat = createFormat({prefix:"G", decimals:0});
var mFormat = createFormat({prefix:"M", decimals:0});var mFormat = createFormat({prefix:"M", decimals:0});
var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4)});var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4)});
var feedFormat = createFormat({decimals:(unit == MM ? 1 : 2)});var feedFormat = createFormat({decimals:(unit == MM ? 1 : 2)});
var toolFormat = createFormat({decimals:0});var toolFormat = createFormat({decimals:0});
var rpmFormat = createFormat({decimals:0});var rpmFormat = createFormat({decimals:0});
var milliFormat = createFormat({decimals:0}); // millisecondsvar milliFormat = createFormat({decimals:0}); // milliseconds
var taperFormat = createFormat({decimals:1, scale:DEG});var taperFormat = createFormat({decimals:1, scale:DEG});
var xOutput = createVariable({prefix:"X"}, xyzFormat);var xOutput = createVariable({prefix:"X"}, xyzFormat);
var yOutput = createVariable({prefix:"Y"}, xyzFormat);var yOutput = createVariable({prefix:"Y"}, xyzFormat);
var zOutput = createVariable({prefix:"Z"}, xyzFormat);var zOutput = createVariable({prefix:"Z"}, xyzFormat);
var feedOutput = createVariable({prefix:"F",force:true}, feedFormat);var feedOutput = createVariable({prefix:"F",force:true}, feedFormat);
var sOutput = createVariable({prefix:"S", force:true}, rpmFormat);var sOutput = createVariable({prefix:"S", force:true}, rpmFormat);
var gMotionModal = createModal({force:true}, gFormat); // modal group 1 // G0-G1, ...var gMotionModal = createModal({force:true}, gFormat); // modal group 1 // G0-G1, ...
var gAbsIncModal = createModal({}, gFormat); // modal group 3 // G90-91var gAbsIncModal = createModal({}, gFormat); // modal group 3 // G90-91
var gUnitModal = createModal({}, gFormat); // modal group 6 // G20-21var gUnitModal = createModal({}, gFormat); // modal group 6 // G20-21
var WARNING_WORK_OFFSET = 0;var WARNING_WORK_OFFSET = 0;
// collected state// collected state
var sequenceNumber;var sequenceNumber;
var currentWorkOffset;var currentWorkOffset;
/**/**
Writes the specified block. Writes the specified block.
*/*/
function writeBlock() {function writeBlock() {
if (properties.showSequenceNumbers) { if (properties.showSequenceNumbers) {
writeWords2("N" + sequenceNumber, arguments); writeWords2("N" + sequenceNumber, arguments);
sequenceNumber += properties.sequenceNumberIncrement; sequenceNumber += properties.sequenceNumberIncrement;
} else { } else {
writeWords(arguments); writeWords(arguments);
} }
}}
function formatComment(text) {function formatComment(text) {
return ";" + String(text).replace(/[\(\)]/g, ""); return ";" + String(text).replace(/[\(\)]/g, "");
}}
/**/**
Output a comment. Output a comment.
*/*/
function writeComment(text) {function writeComment(text) {
writeln(formatComment(text)); writeln(formatComment(text));
}}
function onOpen() {function onOpen() {
if (!properties.separateWordsWithSpace) { if (!properties.separateWordsWithSpace) {
setWordSeparator(""); setWordSeparator("");
} }
sequenceNumber = properties.sequenceNumberStart; sequenceNumber = properties.sequenceNumberStart;
//writeln("%"); //writeln("%");
if (programName) { if (programName) {
writeComment(programName); writeComment(programName);
} }
if (programComment) { if (programComment) {
writeComment(programComment); writeComment(programComment);
} }
// dump machine configuration // dump machine configuration
var vendor = machineConfiguration.getVendor(); var vendor = machineConfiguration.getVendor();
var model = machineConfiguration.getModel(); var model = machineConfiguration.getModel();
var description = machineConfiguration.getDescription(); var description = machineConfiguration.getDescription();
if (properties.writeMachine && (vendor || model || description)) { if (properties.writeMachine && (vendor || model || description)) {
writeComment(localize("Machine")); writeComment(localize("Machine"));
if (vendor) { if (vendor) {
writeComment(" " + localize("vendor") + ": " + vendor); writeComment(" " + localize("vendor") + ": " + vendor);
} }
if (model) { if (model) {
writeComment(" " + localize("model") + ": " + model); writeComment(" " + localize("model") + ": " + model);
} }
if (description) { if (description) {
writeComment(" " + localize("description") + ": " + description); writeComment(" " + localize("description") + ": " + description);
} }
} }
// dump tool information // dump tool information
if (properties.writeTools) { if (properties.writeTools) {
var zRanges = {}; var zRanges = {};
if (is3D()) { if (is3D()) {
var numberOfSections = getNumberOfSections(); var numberOfSections = getNumberOfSections();
for (var i = 0; i < numberOfSections; ++i) { for (var i = 0; i < numberOfSections; ++i) {
var section = getSection(i); var section = getSection(i);
var zRange = section.getGlobalZRange(); var zRange = section.getGlobalZRange();
var tool = section.getTool(); var tool = section.getTool();
if (zRanges[tool.number]) { if (zRanges[tool.number]) {
zRanges[tool.number].expandToRange(zRange); zRanges[tool.number].expandToRange(zRange);
} else { } else {
zRanges[tool.number] = zRange; zRanges[tool.number] = zRange;
} }
} }
} }
var tools = getToolTable(); var tools = getToolTable();
if (tools.getNumberOfTools() > 0) { if (tools.getNumberOfTools() > 0) {
for (var i = 0; i < tools.getNumberOfTools(); ++i) { for (var i = 0; i < tools.getNumberOfTools(); ++i) {
var tool = tools.getTool(i); var tool = tools.getTool(i);
var comment = "T" + toolFormat.format(tool.number) + " " + var comment = "T" + toolFormat.format(tool.number) + " " +
"D=" + xyzFormat.format(tool.diameter) + " " + "D=" + xyzFormat.format(tool.diameter) + " " +
localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); localize("CR") + "=" + xyzFormat.format(tool.cornerRadius);
if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) {
comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg");
} }
if (zRanges[tool.number]) { if (zRanges[tool.number]) {
comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum()); comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum());
} }
comment += " - " + getToolTypeName(tool.type); comment += " - " + getToolTypeName(tool.type);
writeComment(comment); writeComment(comment);
} }
} }
} }
// absolute coordinates // absolute coordinates
writeBlock(gAbsIncModal.format(90)); writeBlock(gAbsIncModal.format(90));
switch (unit) { switch (unit) {
case IN: case IN:
writeBlock(gUnitModal.format(20)); writeBlock(";Units in inches.");
break; break;
case MM: case MM:
writeBlock(gUnitModal.format(21)); writeBlock(";Units in mm");
break; break;
} }
writeBlock(gFormat.format(92) + SP + "X0" + SP + "Y0" + SP + "Z0"); //included to set the machine to zero writeBlock(gFormat.format(92) + SP + "X0" + SP + "Y0" + SP + "Z0"); //included to set the machine to zero
}}
function onComment(message) {function onComment(message) {
writeComment(message); writeComment(message);
}}
/** Force output of X, Y, and Z. *//** Force output of X, Y, and Z. */
function forceXYZ() {function forceXYZ() {
xOutput.reset(); xOutput.reset();
yOutput.reset(); yOutput.reset();
zOutput.reset(); zOutput.reset();
}}
/** Force output of X, Y, Z, A, B, C, and F on next output. *//** Force output of X, Y, Z, A, B, C, and F on next output. */
function forceAny() {function forceAny() {
forceXYZ(); forceXYZ();
feedOutput.reset(); feedOutput.reset();
}}
function onSection() {function onSection() {
var insertToolCall = isFirstSection() || var insertToolCall = isFirstSection() ||
currentSection.getForceToolChange && currentSection.getForceToolChange() || currentSection.getForceToolChange && currentSection.getForceToolChange() ||
(tool.number != getPreviousSection().getTool().number); (tool.number != getPreviousSection().getTool().number);
var retracted = false; // specifies that the tool has been retracted to the safe plane var retracted = false; // specifies that the tool has been retracted to the safe plane
var newWorkOffset = isFirstSection() || var newWorkOffset = isFirstSection() ||
(getPreviousSection().workOffset != currentSection.workOffset); // work offset changes (getPreviousSection().workOffset != currentSection.workOffset); // work offset changes
var newWorkPlane = isFirstSection() || var newWorkPlane = isFirstSection() ||
!isSameDirection(getPreviousSection().getGlobalFinalToolAxis(), currentSection.getGlobalInitialToolAxis()); !isSameDirection(getPreviousSection().getGlobalFinalToolAxis(), currentSection.getGlobalInitialToolAxis());
if (insertToolCall || newWorkOffset || newWorkPlane) { if (insertToolCall || newWorkOffset || newWorkPlane) {
// stop spindle before retract during tool change // stop spindle before retract during tool change
if (insertToolCall && !isFirstSection()) { if (insertToolCall && !isFirstSection()) {
onCommand(COMMAND_STOP_SPINDLE); onCommand(COMMAND_STOP_SPINDLE);
} }
// retract to safe plane // retract to safe plane
retracted = true; retracted = true;
writeBlock(gMotionModal.format(1), "Z0"); //added to return tool to start upon change //writeBlock(gMotionModal.format(1), "Z0"); //added to return tool to start upon change
writeBlock(gMotionModal.format(1), "X0", "Y0"); //return to starting point //writeBlock(gMotionModal.format(1), "X0", "Y0"); //return to starting point
// writeBlock(gFormat.format(28)); //removed to stop homing. // writeBlock(gFormat.format(28)); //removed to stop homing.
zOutput.reset(); zOutput.reset();
} }
writeln(""); writeln("");
if (hasParameter("operation-comment")) { if (hasParameter("operation-comment")) {
var comment = getParameter("operation-comment"); var comment = getParameter("operation-comment");
if (comment) { if (comment) {
writeComment(comment); writeComment(comment);
} }
} }
if (insertToolCall) { if (insertToolCall) {
retracted = true; retracted = true;
setCoolant(COOLANT_OFF); setCoolant(COOLANT_OFF);
if (!isFirstSection() && properties.optionalStop) { if (!isFirstSection() && properties.optionalStop) {
onCommand(COMMAND_OPTIONAL_STOP); onCommand(COMMAND_OPTIONAL_STOP);
} }
if (tool.number > numberOfToolSlots) { if (tool.number > numberOfToolSlots) {
warning(localize("Tool number exceeds maximum value.")); warning(localize("Tool number exceeds maximum value."));
} }
writeBlock("T" + toolFormat.format(tool.number)); writeBlock("G1 Z15 F2000 ;T" + toolFormat.format(tool.number));
if (tool.comment) { if (tool.comment) {
writeComment(tool.comment); writeComment(tool.comment);
} }
var showToolZMin = false; var showToolZMin = false;
if (showToolZMin) { if (showToolZMin) {
if (is3D()) { if (is3D()) {
var numberOfSections = getNumberOfSections(); var numberOfSections = getNumberOfSections();
var zRange = currentSection.getGlobalZRange(); var zRange = currentSection.getGlobalZRange();
var number = tool.number; var number = tool.number;
for (var i = currentSection.getId() + 1; i < numberOfSections; ++i) { for (var i = currentSection.getId() + 1; i < numberOfSections; ++i) {
var section = getSection(i); var section = getSection(i);
if (section.getTool().number != number) { if (section.getTool().number != number) {
break; break;
} }
zRange.expandToRange(section.getGlobalZRange()); zRange.expandToRange(section.getGlobalZRange());
} }
writeComment(localize("ZMIN") + "=" + zRange.getMinimum()); writeComment(localize("ZMIN") + "=" + zRange.getMinimum());
} }
} }
if (properties.preloadTool) { if (properties.preloadTool) {
var nextTool = getNextTool(tool.number); var nextTool = getNextTool(tool.number);
if (nextTool) { if (nextTool) {
writeBlock("T" + toolFormat.format(nextTool.number)); writeBlock(";T" + toolFormat.format(nextTool.number));
} else { } else {
// preload first tool // preload first tool
var section = getSection(0); var section = getSection(0);
var firstToolNumber = section.getTool().number; var firstToolNumber = section.getTool().number;
if (tool.number != firstToolNumber) { if (tool.number != firstToolNumber) {
writeBlock("T" + toolFormat.format(firstToolNumber)); writeBlock(";T" + toolFormat.format(firstToolNumber));
} }
} }
} }
} }
if (insertToolCall || if (insertToolCall ||
isFirstSection() || isFirstSection() ||
(rpmFormat.areDifferent(tool.spindleRPM, sOutput.getCurrent())) || (rpmFormat.areDifferent(tool.spindleRPM, sOutput.getCurrent())) ||
(tool.clockwise != getPreviousSection().getTool().clockwise)) { (tool.clockwise != getPreviousSection().getTool().clockwise)) {
if (tool.spindleRPM < 1) { if (tool.spindleRPM < 1) {
error(localize("Spindle speed out of range.")); error(localize("Spindle speed out of range."));
} }
if (tool.spindleRPM > 99999) { if (tool.spindleRPM > 99999) {
warning(localize("Spindle speed exceeds maximum value.")); warning(localize("Spindle speed exceeds maximum value."));
} }
writeBlock( writeBlock(
//sOutput.format(tool.spindleRPM), mFormat.format(tool.clockwise ? 3 : 4) //sOutput.format(tool.spindleRPM), mFormat.format(tool.clockwise ? 3 : 4)
mFormat.format(106) mFormat.format(106)
); );
} }
// wcs // wcs
var workOffset = currentSection.workOffset; var workOffset = currentSection.workOffset;
if (workOffset != 0) { if (workOffset != 0) {
warningOnce(localize("Work offset is not supported."), WARNING_WORK_OFFSET); warningOnce(localize("Work offset is not supported."), WARNING_WORK_OFFSET);
} }
forceXYZ(); forceXYZ();
{ // pure 3D { // pure 3D
var remaining = currentSection.workPlane; var remaining = currentSection.workPlane;
if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) { if (!isSameDirection(remaining.forward, new Vector(0, 0, 1))) {
error(localize("Tool orientation is not supported.")); error(localize("Tool orientation is not supported."));
return; return;
} }
setRotation(remaining); setRotation(remaining);
} }
// set coolant after we have positioned at Z // set coolant after we have positioned at Z
setCoolant(tool.coolant); setCoolant(tool.coolant);
forceAny(); forceAny();
var initialPosition = getFramePosition(currentSection.getInitialPosition()); var initialPosition = getFramePosition(currentSection.getInitialPosition());
if (!retracted) { if (!retracted) {
if (getCurrentPosition().z < initialPosition.z) { if (getCurrentPosition().z < initialPosition.z) {
writeBlock(gMotionModal.format(0), zOutput.format(initialPosition.z)); writeBlock(gMotionModal.format(0), zOutput.format(initialPosition.z));
} }
} }
if (insertToolCall || retracted) { if (insertToolCall || retracted) {
gMotionModal.reset(); gMotionModal.reset();
writeBlock( writeBlock(
gAbsIncModal.format(90), gAbsIncModal.format(90),
gMotionModal.format(properties.useG0 ? 0 : 1), xOutput.format(initialPosition.x), yOutput.format(initialPosition.y), gMotionModal.format(properties.useG0 ? 0 : 1), xOutput.format(initialPosition.x), yOutput.format(initialPosition.y),
conditional(!properties.useG0, feedOutput.format(highFeedrate)) conditional(!properties.useG0, feedOutput.format(highFeedrate))
); );
writeBlock(gMotionModal.format(properties.useG0 ? 0 : 1), zOutput.format(initialPosition.z), conditional(!properties.useG0, feedOutput.format(highFeedrate))); writeBlock(gMotionModal.format(properties.useG0 ? 0 : 1), zOutput.format(initialPosition.z), conditional(!properties.useG0, feedOutput.format(highFeedrate)));
} else { } else {
writeBlock( writeBlock(
gAbsIncModal.format(90), gAbsIncModal.format(90),
gMotionModal.format(properties.useG0 ? 0 : 1), gMotionModal.format(properties.useG0 ? 0 : 1),
xOutput.format(initialPosition.x), xOutput.format(initialPosition.x),
yOutput.format(initialPosition.y), yOutput.format(initialPosition.y),
conditional(!properties.useG0, feedOutput.format(highFeedrate)) conditional(!properties.useG0, feedOutput.format(highFeedrate))
); );
} }
}}
var currentCoolantMode = undefined;var currentCoolantMode = undefined;
function setCoolant(coolant) {function setCoolant(coolant) {
if (coolant == currentCoolantMode) { if (coolant == currentCoolantMode) {
return; // coolant is already active return; // coolant is already active
} }
var m = undefined; var m = undefined;
if (coolant == COOLANT_OFF) { if (coolant == COOLANT_OFF) {
m = 9; m = 9;
writeBlock(mFormat.format(m)); //writeBlock(";coolant off");
currentCoolantMode = COOLANT_OFF; currentCoolantMode = COOLANT_OFF;
return; return;
} }
if (currentCoolantMode != COOLANT_OFF) { if (currentCoolantMode != COOLANT_OFF) {
setCoolant(COOLANT_OFF); setCoolant(COOLANT_OFF);
} }
switch (coolant) { switch (coolant) {
case COOLANT_FLOOD: case COOLANT_FLOOD:
m = 8; m = 8;
break; break;
default: default:
warning(localize("Coolant not supported.")); warning(localize("Coolant not supported."));
if (currentCoolantMode == COOLANT_OFF) { if (currentCoolantMode == COOLANT_OFF) {
return; return;
} }
coolant = COOLANT_OFF; coolant = COOLANT_OFF;
m = 9; m = 9;
} }
writeBlock(mFormat.format(m)); //writeBlock(";coolant is ");
currentCoolantMode = coolant; currentCoolantMode = coolant;
}}
function onDwell(seconds) {function onDwell(seconds) {
if (seconds > 99999.999) { if (seconds > 99999.999) {
warning(localize("Dwelling time is out of range.")); warning(localize("Dwelling time is out of range."));
} }
milliseconds = clamp(1, seconds * 1000, 99999); milliseconds = clamp(1, seconds * 1000, 99999);
writeBlock(gFormat.format(4), "P" + milliFormat.format(milliseconds)); writeBlock(gFormat.format(4), "P" + milliFormat.format(milliseconds));
}}
function onSpindleSpeed(spindleSpeed) {function onSpindleSpeed(spindleSpeed) {
writeBlock(sOutput.format(spindleSpeed)); writeBlock(sOutput.format(spindleSpeed));
}}
var pendingRadiusCompensation = -1;var pendingRadiusCompensation = -1;
function onRadiusCompensation() {function onRadiusCompensation() {
pendingRadiusCompensation = radiusCompensation; pendingRadiusCompensation = radiusCompensation;
}}
function onRapid(_x, _y, _z) {function onRapid(_x, _y, _z) {
var x = xOutput.format(_x); var x = xOutput.format(_x);
var y = yOutput.format(_y); var y = yOutput.format(_y);
var z = zOutput.format(_z); var z = zOutput.format(_z);
if (x || y || z) { if (x || y || z) {
if (pendingRadiusCompensation >= 0) { if (pendingRadiusCompensation >= 0) {
error(localize("Radius compensation mode cannot be changed at rapid traversal.")); error(localize("Radius compensation mode cannot be changed at rapid traversal."));
return; return;
} }
if (!properties.useG0) { if (!properties.useG0) {
writeBlock(gMotionModal.format(1), x, y, z, feedOutput.format(highFeedrate)); writeBlock(gMotionModal.format(1), x, y, z, feedOutput.format(highFeedrate));
} else { } else {
writeBlock(gMotionModal.format(0), x, y, z); writeBlock(gMotionModal.format(0), x, y, z);
} }
feedOutput.reset(); feedOutput.reset();
} }
}}
function onLinear(_x, _y, _z, feed) {function onLinear(_x, _y, _z, feed) {
// at least one axis is required // at least one axis is required
if (pendingRadiusCompensation >= 0) { if (pendingRadiusCompensation >= 0) {
// ensure that we end at desired position when compensation is turned off // ensure that we end at desired position when compensation is turned off
xOutput.reset(); xOutput.reset();
yOutput.reset(); yOutput.reset();
} }
var x = xOutput.format(_x); var x = xOutput.format(_x);
var y = yOutput.format(_y); var y = yOutput.format(_y);
var z = zOutput.format(_z); var z = zOutput.format(_z);
var f = feedOutput.format(feed); var f = feedOutput.format(feed);
if (x || y || z) { if (x || y || z) {
if (pendingRadiusCompensation >= 0) { if (pendingRadiusCompensation >= 0) {
error(localize("Radius compensation mode is not supported.")); error(localize("Radius compensation mode is not supported."));
return; return;
} else { } else {
writeBlock(gMotionModal.format(1), x, y, z, f); writeBlock(gMotionModal.format(1), x, y, z, f);
} }
} else if (f) { } else if (f) {
if (getNextRecord().isMotion()) { // try not to output feed without motion if (getNextRecord().isMotion()) { // try not to output feed without motion
feedOutput.reset(); // force feed on next line feedOutput.reset(); // force feed on next line
} else { } else {
writeBlock(gMotionModal.format(1), f); writeBlock(gMotionModal.format(1), f);
} }
} }
}}
function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
linearize(tolerance); linearize(tolerance);
}}
var mapCommand = {var mapCommand = {
COMMAND_STOP:0, COMMAND_STOP:0,
COMMAND_OPTIONAL_STOP:1, COMMAND_OPTIONAL_STOP:1,
COMMAND_SPINDLE_CLOCKWISE:106, COMMAND_SPINDLE_CLOCKWISE:106,
COMMAND_SPINDLE_COUNTERCLOCKWISE:4, COMMAND_SPINDLE_COUNTERCLOCKWISE:4,
COMMAND_STOP_SPINDLE:107, COMMAND_STOP_SPINDLE:107,
};};
function onCommand(command) {function onCommand(command) {
switch (command) { switch (command) {
case COMMAND_START_SPINDLE: case COMMAND_START_SPINDLE:
onCommand(tool.clockwise ? COMMAND_SPINDLE_CLOCKWISE : COMMAND_SPINDLE_COUNTERCLOCKWISE); onCommand(tool.clockwise ? COMMAND_SPINDLE_CLOCKWISE : COMMAND_SPINDLE_COUNTERCLOCKWISE);
return; return;
case COMMAND_LOCK_MULTI_AXIS: case COMMAND_LOCK_MULTI_AXIS:
return; return;
case COMMAND_UNLOCK_MULTI_AXIS: case COMMAND_UNLOCK_MULTI_AXIS:
return; return;
case COMMAND_BREAK_CONTROL: case COMMAND_BREAK_CONTROL:
return; return;
case COMMAND_TOOL_MEASURE: case COMMAND_TOOL_MEASURE:
return; return;
} }
var stringId = getCommandStringId(command); var stringId = getCommandStringId(command);
var mcode = mapCommand[stringId]; var mcode = mapCommand[stringId];
if (mcode != undefined) { if (mcode != undefined) {
writeBlock(mFormat.format(mcode)); writeBlock(mFormat.format(mcode));
} else { } else {
onUnsupportedCommand(command); onUnsupportedCommand(command);
} }
}}
function onSectionEnd() {function onSectionEnd() {
forceAny(); forceAny();
}}
function onClose() {function onClose() {
setCoolant(COOLANT_OFF); setCoolant(COOLANT_OFF);
// writeBlock(gFormat.format(28)); // retract // writeBlock(gFormat.format(91)); // Relative positioning
writeBlock(gMotionModal.format(1), "Z0"); //added to return tool to zero at the end //writeBlock(gMotionModal.format(1), "Z0"); //added to return tool to zero at the end
writeBlock(gMotionModal.format(1), "X0", "Y0"); //return to zero //writeBlock(gMotionModal.format(1), "X0", "Y0"); //return to zero
zOutput.reset(); zOutput.reset();
onCommand(COMMAND_STOP_SPINDLE); onCommand(COMMAND_STOP_SPINDLE);
writeBlock(mFormat.format(0)); // stop program writeBlock(mFormat.format(84) + "; Turn steppers off");
//writeln("%"); //writeln("%");
}}
Editor
Original Text
Changed Text