关闭 4个任务 cleeguy 打开了这个问题 2019 年 2 月 16 日 · 1条评论 关闭 4个任务 CNCjs – Tinyg 错误 202 Fusion 360 后#408 cleeguy 打开了这个问题 2019 年 2 月 16 日 · 1条评论 评论 清洁工 评论了 2019 年 2 月 16 日 描述 TinyG 的 Fusion 360 帖子,当我尝试在 CNCjs 中运行文件时,第一步,它冻结并给出错误 202,min move。我试过降低进给速度,调整公差平滑度,但无法克服这个错误。 版本 CNCjs:1.9.15 节点.js:6.x NPM:5.x 你如何安装CNCjs? [] NPM [ x] 下载 CNCjs 桌面应用程序 数控系统 [] 格布 冰沙 [ x] TinyG/g2core 硬件 [] 树莓派 [x] 台式机或笔记本电脑 移动设备 操作系统 [] 不适用 [x] 窗户 苹果 Linux 这是我的 nc 文件: 它在 cncjs 上的第 52 行,也就是此处发布的最后一行,在切割前的第一步冻结。 (1001) (T1 D=3.175 CR=0. – ZMIN=-6.549 – 平立铣刀) G0 G90 G94 G17 G21 G0 Z4. (自适应 1) M5 M9 T1 M3 S24446 G54 G0 X-26.984 Y-9.327 Z4。 Z1.334 G1 Z1.016 F762。 Z-0.254 F254。 G3 X-26.027 Y-11.976 I5.97 J0.66 F1863。 X-25.403 Y-10.946 I-0.895 J1.245 X-25.126 Y-6.665 I-20.062 J3.452 X-25.114 Y-3.825 I-38.008 J1.577 X-25.319 Y-3.724 I-0.189 J-0.125 X- 25.508 Y-3.854 I0.017 J-0.226 G1 X-25.517 Y-3.886 F762。 X-25.526 Y-3.94 Y-3.996 X-25.516 Y-4.05 X-25.505 Y-4.072 X-25.486 Y-4.089 X-25.463 Y-4.097 X-25.438 Y-4.095 X-25.412 X-25.391 Y-4.11 X- 25.381 Y-4.133 X-25.386 Y -4.158 X- 25.403 Y-4.177 X-25.421 Y-4.182 X-25.44 Y-4.179 X-25.455 Y-4.167 G2 X-25.507 Y-3.854 I0.246 J0.201 G1 X-25.308 Y-3.378 F1677。 G2 X-24.474 Y-3.56 I0.306 J-0.598 X-23.52 Y-5.408 I-1.872 J- 2.136 X-23.647 Y-11.32 I-14.711 J-2.643 X-24.451 Y-12.762 I-5.263 J1.988 G1 X-24.592 Y- 13.062 X-24.684 Y -13.322 G2 X-24.967 Y-13.54 I-0.309 J0.109 X-25.28 Y-13.371 I-0.026 J0.326 G1 X-25.304 Y-13.308 F762。 X-25.314 Y-13.243 X-25.31 Y-13.177 这是我的 tinyg 配置文件: /** Autodesk, Inc 版权所有 (C) 2012-2018。 保留所有权利。 TinyG 后处理器配置。 ��������:42071��911�15��16�0825���27�9�231204�8�76�27� ����:2018−08−0910:29:50 FORKID {19EA9069-B05C-460b-A06C-C5264A4FF852} */ 描述=“TinyG”; vendor = “合成器”; vendorUrl = ” https://www.synthetos.com “; legal = “Autodesk, Inc 版权所有 (C) 2012-2018。”; 认证级别 = 2; 最小修订版 = 40783; longDescription = “TinyG 的通用帖子。”; 扩展名=“gcode”; setCodePage(“ascii”); 能力 = CAPABILITY_MILLING; 公差=空间(0.002,MM); minimumChordLength = spatial(0.25, MM); minimumCircularRadius = spatial(0.01, MM); 最大圆半径=空间(1000,MM); minimumCircularSweep = toRad(0.01); maximumCircularSweep = toRad(120); allowHelicalMoves = false; allowedCircularPlanes = 1 << PLANE_XY; // 用户定义的属性 properties = { writeMachine: true, // 写入机器 writeTools: true, // 写入工具 useM6: false, // 禁用以避免 M6 输出 – 当 M6 被禁用时预加载也被禁用 preloadTool: false, // 如果有任何工具更改,则预加载下一个工具 showSequenceNumbers: false, // 显示序列号 sequenceNumberStart: 10, // 第一个序列号 sequenceNumberIncrement: 5, // 序列号递增 optionalStop: true, // 可选停止 separateWordsWithSpace: true, // 指定单词应该用空格 分隔 useActiveSpindle: true, // 允许使用主轴 S、M3、M4、… useRadius: false, // 指定应使用半径(R 字)而不是 I、J 和 K 字 输出圆弧 useG28: false // 指定使用 G28 进行退刀 }; // 用户自定义属性定义 propertyDefinitions = { writeMachine: {title:”写机”, description:”在代码头部输出机器设置。”, group:0, type:”boolean”}, writeTools: { title:”Write tool list”, description:”在代码头部输出一个工具列表。”, group:0, type:”boolean”}, useM6: {title:”Use M6″, description:”Disable to避免输出 M6。如果禁用预加载也被禁用”,组:1,类型:“布尔值”}, preloadTool:{title:“预加载工具”,描述:“在工具更改时预加载下一个工具(如果有)。 , group:1, type:”boolean”}, showSequenceNumbers: {title:”Use sequence numbers”, 描述:”为每个输出代码块使用序列号。”, group:1, type:”boolean”}, sequenceNumberStart: {title:”开始序号”, description:”开始序号的数字。”, group:1, type:”integer”}, sequenceNumberIncrement: {title:”序号增量”, description: “序列号在每个块中递增的量。”, group:1, type:”integer”}, optionalStop: {title:”Optional stop”, description:”在必要时输出可选的停止代码code.”, type:”boolean”}, separateWordsWithSpace: {title:”Separate words with space”, description:”如果选择’yes’,则在单词之间添加空格。”, type:”boolean”}, useActiveSpindle: {title :“使用主动主轴”,说明:“允许使用主轴命令(S、M3、M4、…)。”, type:”boolean”}, useRadius: {title:”Radius arcs”, description:”如果选择是,则使用半径值而不是 IJK 输出弧。”, type:”boolean”}, useG28: {title:”Use G28″, description:”禁用以避免 G28 输出以实现安全机器缩回 – 禁用时将使用最大间隙高度。”, type:”boolean”} }; var permittedCommentChars = “ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-“; // 示例: // throughTool: {on: 88, off: 89} // throughTool: {on: [8, 88], off: [9, 89]} var coolants = { flood: {on: 8}, 雾:{on: 7} , throughTool: {}, air: {}, airThroughTool: {}, suction: {}, floodMist: {}, floodThroughTool: {}, off: 9 }; var nFormat = createFormat({prefix:”N”, decimals:0}); var gFormat = createFormat({prefix:”G”, decimals:0}); var mFormat = createFormat({prefix:”M”, decimals:0}); var hFormat = createFormat({prefix:”H”, decimals:0}); // 目前不支持 var dFormat = createFormat({prefix:”D”, decimals:0}); // 目前不支持 var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4), forceDecimal:true}); var rFormat = xyzFormat; // 半径 var abcFormat = createFormat({decimals:3, forceDecimal:true, scale:DEG}); var feedFormat = createFormat({decimals:(unit == MM ? 0 : 1), forceDecimal:true}); var toolFormat = createFormat({decimals:0}); var rpmFormat = createFormat({decimals:0}); var secFormat = createFormat({decimals:3, forceDecimal:true}); // 秒 – 范围 0.001-99999.999 var milliFormat = createFormat({decimals:0}); // 毫秒 // 范围 1-9999 var taperFormat = createFormat({decimals:1, scale:DEG}); var xOutput = createVariable({prefix:”X”}, xyzFormat); var yOutput = createVariable({prefix:”Y”}, xyzFormat); var zOutput = createVariable({onchange:function () {retracted = false;}, prefix:”Z”}, xyzFormat); var aOutput = createVariable({prefix:”A”}, abcFormat); var bOutput = createVariable({prefix:”B”}, abcFormat); var cOutput = createVariable({prefix:”C”}, abcFormat); var feedOutput = createVariable({prefix:”F”}, feedFormat); var sOutput = createVariable({prefix:”S”, force:true}, rpmFormat); var dOutput = createVariable({}, dFormat); // 循环输出 var iOutput = createReferenceVariable({prefix:”I”, force:true}, xyzFormat); var jOutput = createReferenceVariable({prefix:”J”, force:true}, xyzFormat); var kOutput = createReferenceVariable({prefix:”K”, force:true}, xyzFormat); var gMotionModal = createModal({}, gFormat); // 模态组 1 // G0-G3, … var gPlaneModal = createModal({onchange:function () {gMotionModal.reset();}}, gFormat); // 模态组 2 // G17-19 var gAbsIncModal = createModal({}, gFormat); // 模态组 3 // G90-91 var gFeedModeModal = createModal({}, gFormat); // 模态组 5 // G93-94 var gUnitModal = createModal({}, gFormat); // 模态组 6 // G20-21 var gRetractModal = createModal({}, gFormat); // 模态组 10 // G98-99 var WARNING_WORK_OFFSET = 0; // 收集的状态 var sequenceNumber; var currentWorkOffset; var maximumClearanceHeight = -1; var 缩回 = false;// 指定刀具已退回到安全平面 /** 写入指定块。 */ function writeBlock() { if (!formatWords(arguments)) { 返回; } if (properties.showSequenceNumbers) { writeWords2(nFormat.format(sequenceNumber % 100000), arguments); sequenceNumber += properties.sequenceNumberIncrement; } else { writeWords(参数); } } /** 输出注释。 */ function writeComment(text) { writeln(“(” + filterText(String(text).toUpperCase(), permittedCommentChars) + “)”); } function onOpen() { if (properties.useRadius) { maximumCircularSweep = toRad(90); // 避免 CNC 潜在的中心计算错误 } 如果 (!machineConfiguration.isMachineCoordinate(0)) { aOutput.disable(); } if (!machineConfiguration.isMachineCoordinate(1)) { bOutput.disable(); } if (!machineConfiguration.isMachineCoordinate(2)) { cOutput.disable(); } 如果 (!properties.separateWordsWithSpace) { setWordSeparator(“”); } sequenceNumber = properties.sequenceNumberStart; 如果(程序名){ writeComment(程序名); } if (programComment) { writeComment(programComment); } // 转储机器配置 var vendor = machineConfiguration.getVendor(); var model = machineConfiguration.getModel(); var description = machineConfiguration.getDescription(); if (properties.writeMachine && (vendor || model || description)) { writeComment(localize(“Machine”)); 如果(供应商){ writeComment(” ” + localize(“供应商”) + “: ” + 供应商); } if (model) { writeComment(” ” + localize(“model”) + “: ” + model); } if (description) { writeComment(” ” + localize(“description”) + “: ” + description); } } // 转储工具信息 if (properties.writeTools) { var zRanges = {}; 如果 (is3D()) { var numberOfSections = getNumberOfSections(); 对于 (var i = 0; i < numberOfSections; ++i) { var section = getSection(i); var zRange = section.getGlobalZRange(); var tool = section.getTool(); 如果 (zRanges[tool.number]) { zRanges[tool.number].expandToRange(zRange); } else { zRanges[tool.number] = zRange; } } } var tools = getToolTable(); if (tools.getNumberOfTools() > 0) { for (var i = 0; i < tools.getNumberOfTools(); ++i) { var tool = tools.getTool(i); var comment = "T" + toolFormat.format(tool.number) + " " + "D=" + xyzFormat.format(tool.diameter) + " " + localize("CR") + "=" + xyzFormat.format(tool.cornerRadius); if ((tool.taperAngle > 0) && (tool.taperAngle < Math.PI)) { comment += " " + localize("TAPER") + "=" + taperFormat.format(tool.taperAngle) + localize("deg"); } if (zRanges[tool.number]) { comment += " - " + localize("ZMIN") + "=" + xyzFormat.format(zRanges[tool.number].getMinimum()); } comment += " - " + getToolTypeName(tool.type); writeComment(comment); } } } if (false) { // 检查重复的工具编号 for (var i = 0; i < getNumberOfSections(); ++i) { var sectioni = getSection(i); var tooli = sectioni.getTool(); 对于 (var j = i + 1; j < getNumberOfSections(); ++j) { var sectionj = getSection(j); var toolj = sectionj.getTool(); 如果(tooli.number == toolj.number){ 如果(xyzFormat.areDifferent(tooli.diameter,toolj.diameter)|| xyzFormat.areDifferent(tooli.cornerRadius,toolj.cornerRadius)|| abcFormat.areDifferent(tooli.taperAngle, toolj.taperAngle) || (tooli.numberOfFlutes != toolj.numberOfFlutes)) { error( subst( localize(“对操作 ‘%1’ 和 ‘%2’ 的不同刀具几何形状使用相同的刀具编号。”), sectioni.hasParameter(“operation-comment”) ? sectioni.getParameter(“operation-comment”) : (“#” + (i + 1)), sectionj.hasParameter(“operation-comment”) ?sectionj.getParameter(“operation-comment”) : (“#” + (j + 1)) ) ); 返回; } } } } } if ((getNumberOfSections() > 0) && (getSection(0).workOffset == 0)) { for (var i = 0; i < getNumberOfSections(); ++i) { if (getSection(i).workOffset > 0) { error(localize(“如果初始工件偏移量为 0,则无法使用多个工件偏移量。”)); 返回; } } } 如果 (!properties.useG28) { 如果 (is3D()) { var numberOfSections = getNumberOfSections(); 对于 (var i = 0; i < numberOfSections; ++i) { var section = getSection(i); 如果 (section.getGlobalZRange().getMaximum() > maximumClearanceHeight) { maximumClearanceHeight = section.getGlobalZRange().getMaximum(); warning(localize(“缩回高度已更新。”)); } if (i != 0 && getSection(i – 1).workOffset != section.workOffset) { error(localize(“只有在使用相同的工件偏移量时才能使用退刀间隙高度。”)); 返回; } } } else { error(localize(“只有 3 轴刀具路径才能使用退刀间隙高度。”)); 返回; } } // 绝对坐标和每分钟进给 writeBlock(gFormat.format(0), gAbsIncModal.format(90), gFeedModeModal.format(94), gPlaneModal.format(17)); switch (unit) { case IN: writeBlock(gUnitModal.format(20)); 休息; 案例 MM: writeBlock(gUnitModal.format(21)); 休息; } } function onComment(message) { var comments = String(message).split(“;”); 对于(评论中的评论){ writeComment(评论[评论]); } } /** 强制输出 X、Y 和 Z。 */ function forceXYZ() { xOutput.reset(); yOutput.reset(); zOutput.reset(); } /** 强制输出 A、B 和 C。 */ function forceABC() { aOutput.reset(); bOutput.reset(); cOutput.reset(); } /** 在下一次输出时强制输出 X、Y、Z、A、B、C 和 F。*/ function forceAny() { forceXYZ(); 强制ABC(); feedOutput.reset(); } var currentWorkPlaneABC = undefined; 函数 forceWorkPlane() { currentWorkPlaneABC = undefined; } function setWorkPlane(abc) { if (!machineConfiguration.isMultiAxisConfiguration()) { 返回;// 忽略 } 如果 (!((currentWorkPlaneABC == undefined) || abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) || abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) || abcFormat.areDifferent(abc.z, currentWorkPlaneABC. z))) { 返回;// 没有变化 } onCommand(COMMAND_UNLOCK_MULTI_AXIS); 如果(!缩回){ writeRetract(Z); } writeBlock( gMotionModal.format(0), 条件(machineConfiguration.isMachineCoordinate(0),“A”+ abcFormat.format(abc.x)), 条件(machineConfiguration.isMachineCoordinate(1),“B”+ abcFormat.format(abc .y)), 条件(machineConfiguration.isMachineCoordinate(2), “C” + abcFormat.format(abc.z)) ); onCommand(COMMAND_LOCK_MULTI_AXIS); 当前工作平面ABC = abc; } var closestABC = false; // 选择最接近的机器角度 var currentMachineABC; 函数 getWorkPlaneMachineABC(workPlane) { var W = workPlane; // 映射到全局框架 var abc = machineConfiguration.getABC(W); 如果 (closestABC) { 如果 (currentMachineABC) { abc = machineConfiguration.remapToABC(abc, currentMachineABC); } else { abc = machineConfiguration.getPreferredABC(abc); } } else { abc = machineConfiguration.getPreferredABC(abc); } try { abc = machineConfiguration.remapABC(abc); currentMachineABC = abc; } catch (e) { error( localize(“Machine angles not supported”) + “:” + conditional(machineConfiguration.isMachineCoordinate(0), ” A” + abcFormat.format(abc.x)) + conditional(machineConfiguration.isMachineCoordinate(1), ” B” + abcFormat.format(abc.y)) + conditional(machineConfiguration.isMachineCoordinate(2), ” C” + abcFormat.format(abc.z)) 喜欢 (0)
描述
TinyG 的 Fusion 360 帖子,当我尝试在 CNCjs 中运行文件时,第一步,它冻结并给出错误 202,min move。我试过降低进给速度,调整公差平滑度,但无法克服这个错误。
版本
你如何安装CNCjs?
数控系统
硬件
操作系统
这是我的 nc 文件:
它在 cncjs 上的第 52 行,也就是此处发布的最后一行,在切割前的第一步冻结。
(1001)
(T1 D=3.175 CR=0. – ZMIN=-6.549 – 平立铣刀)
G0 G90 G94 G17
G21
G0 Z4.
(自适应 1)
M5
M9
T1
M3 S24446
G54
G0 X-26.984 Y-9.327
Z4。
Z1.334
G1 Z1.016 F762。
Z-0.254 F254。
G3 X-26.027 Y-11.976 I5.97 J0.66 F1863。
X-25.403 Y-10.946 I-0.895 J1.245
X-25.126 Y-6.665 I-20.062 J3.452
X-25.114 Y-3.825 I-38.008 J1.577
X-25.319 Y-3.724 I-0.189 J-0.125
X- 25.508 Y-3.854 I0.017 J-0.226
G1 X-25.517 Y-3.886 F762。
X-25.526 Y-3.94
Y-3.996
X-25.516 Y-4.05
X-25.505 Y-4.072
X-25.486 Y-4.089
X-25.463 Y-4.097
X-25.438 Y-4.095
X-25.412
X-25.391 Y-4.11
X- 25.381 Y-4.133
X-25.386 Y -4.158 X-
25.403 Y-4.177
X-25.421 Y-4.182
X-25.44 Y-4.179
X-25.455 Y-4.167
G2 X-25.507 Y-3.854 I0.246 J0.201
G1 X-25.308 Y-3.378 F1677。
G2 X-24.474 Y-3.56 I0.306 J-0.598
X-23.52 Y-5.408 I-1.872 J-
2.136 X-23.647 Y-11.32 I-14.711 J-2.643
X-24.451 Y-12.762 I-5.263 J1.988
G1 X-24.592 Y- 13.062 X-24.684 Y
-13.322
G2 X-24.967 Y-13.54 I-0.309 J0.109
X-25.28 Y-13.371 I-0.026 J0.326
G1 X-25.304 Y-13.308 F762。
X-25.314 Y-13.243
X-25.31 Y-13.177
这是我的 tinyg 配置文件:
/**
Autodesk, Inc 版权所有 (C) 2012-2018。
保留所有权利。
TinyG 后处理器配置。
��������:42071��911�15��16�0825���27�9�231204�8�76�27�
����:2018−08−0910:29:50
FORKID {19EA9069-B05C-460b-A06C-C5264A4FF852}
*/
描述=“TinyG”;
vendor = “合成器”;
vendorUrl = ” https://www.synthetos.com “;
legal = “Autodesk, Inc 版权所有 (C) 2012-2018。”;
认证级别 = 2;
最小修订版 = 40783;
longDescription = “TinyG 的通用帖子。”;
扩展名=“gcode”;
setCodePage(“ascii”);
能力 = CAPABILITY_MILLING;
公差=空间(0.002,MM);
minimumChordLength = spatial(0.25, MM);
minimumCircularRadius = spatial(0.01, MM);
最大圆半径=空间(1000,MM);
minimumCircularSweep = toRad(0.01);
maximumCircularSweep = toRad(120);
allowHelicalMoves = false;
allowedCircularPlanes = 1 << PLANE_XY;
// 用户定义的属性
properties = {
writeMachine: true, // 写入机器
writeTools: true, // 写入工具
useM6: false, // 禁用以避免 M6 输出 – 当 M6 被禁用时预加载也被禁用
preloadTool: false, // 如果有任何工具更改,则预加载下一个工具
showSequenceNumbers: false, // 显示序列号
sequenceNumberStart: 10, // 第一个序列号
sequenceNumberIncrement: 5, // 序列号递增
optionalStop: true, // 可选停止
separateWordsWithSpace: true, // 指定单词应该用空格
分隔 useActiveSpindle: true, // 允许使用主轴 S、M3、M4、…
useRadius: false, // 指定应使用半径(R 字)而不是 I、J 和 K 字
输出圆弧 useG28: false // 指定使用 G28 进行退刀
};
// 用户自定义属性定义
propertyDefinitions = {
writeMachine: {title:”写机”, description:”在代码头部输出机器设置。”, group:0, type:”boolean”},
writeTools: { title:”Write tool list”, description:”在代码头部输出一个工具列表。”, group:0, type:”boolean”},
useM6: {title:”Use M6″, description:”Disable to避免输出 M6。如果禁用预加载也被禁用”,组:1,类型:“布尔值”},
preloadTool:{title:“预加载工具”,描述:“在工具更改时预加载下一个工具(如果有)。 , group:1, type:”boolean”},
showSequenceNumbers: {title:”Use sequence numbers”, 描述:”为每个输出代码块使用序列号。”, group:1, type:”boolean”},
sequenceNumberStart: {title:”开始序号”, description:”开始序号的数字。”, group:1, type:”integer”},
sequenceNumberIncrement: {title:”序号增量”, description: “序列号在每个块中递增的量。”, group:1, type:”integer”},
optionalStop: {title:”Optional stop”, description:”在必要时输出可选的停止代码code.”, type:”boolean”},
separateWordsWithSpace: {title:”Separate words with space”, description:”如果选择’yes’,则在单词之间添加空格。”, type:”boolean”},
useActiveSpindle: {title :“使用主动主轴”,说明:“允许使用主轴命令(S、M3、M4、…)。”, type:”boolean”},
useRadius: {title:”Radius arcs”, description:”如果选择是,则使用半径值而不是 IJK 输出弧。”, type:”boolean”},
useG28: {title:”Use G28″, description:”禁用以避免 G28 输出以实现安全机器缩回 – 禁用时将使用最大间隙高度。”, type:”boolean”}
};
var permittedCommentChars = “ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,=_-“;
// 示例:
// throughTool: {on: 88, off: 89}
// throughTool: {on: [8, 88], off: [9, 89]}
var coolants = {
flood: {on: 8},
雾:{on: 7} , throughTool:
{},
air: {},
airThroughTool: {},
suction: {},
floodMist: {},
floodThroughTool: {},
off: 9
};
var nFormat = createFormat({prefix:”N”, decimals:0});
var gFormat = createFormat({prefix:”G”, decimals:0});
var mFormat = createFormat({prefix:”M”, decimals:0});
var hFormat = createFormat({prefix:”H”, decimals:0}); // 目前不支持
var dFormat = createFormat({prefix:”D”, decimals:0}); // 目前不支持
var xyzFormat = createFormat({decimals:(unit == MM ? 3 : 4), forceDecimal:true});
var rFormat = xyzFormat; // 半径
var abcFormat = createFormat({decimals:3, forceDecimal:true, scale:DEG});
var feedFormat = createFormat({decimals:(unit == MM ? 0 : 1), forceDecimal:true});
var toolFormat = createFormat({decimals:0});
var rpmFormat = createFormat({decimals:0});
var secFormat = createFormat({decimals:3, forceDecimal:true}); // 秒 – 范围 0.001-99999.999
var milliFormat = createFormat({decimals:0}); // 毫秒 // 范围 1-9999
var taperFormat = createFormat({decimals:1, scale:DEG});
var xOutput = createVariable({prefix:”X”}, xyzFormat);
var yOutput = createVariable({prefix:”Y”}, xyzFormat);
var zOutput = createVariable({onchange:function () {retracted = false;}, prefix:”Z”}, xyzFormat);
var aOutput = createVariable({prefix:”A”}, abcFormat);
var bOutput = createVariable({prefix:”B”}, abcFormat);
var cOutput = createVariable({prefix:”C”}, abcFormat);
var feedOutput = createVariable({prefix:”F”}, feedFormat);
var sOutput = createVariable({prefix:”S”, force:true}, rpmFormat);
var dOutput = createVariable({}, dFormat);
// 循环输出
var iOutput = createReferenceVariable({prefix:”I”, force:true}, xyzFormat);
var jOutput = createReferenceVariable({prefix:”J”, force:true}, xyzFormat);
var kOutput = createReferenceVariable({prefix:”K”, force:true}, xyzFormat);
var gMotionModal = createModal({}, gFormat); // 模态组 1 // G0-G3, …
var gPlaneModal = createModal({onchange:function () {gMotionModal.reset();}}, gFormat); // 模态组 2 // G17-19
var gAbsIncModal = createModal({}, gFormat); // 模态组 3 // G90-91
var gFeedModeModal = createModal({}, gFormat); // 模态组 5 // G93-94
var gUnitModal = createModal({}, gFormat); // 模态组 6 // G20-21
var gRetractModal = createModal({}, gFormat); // 模态组 10 // G98-99
var WARNING_WORK_OFFSET = 0;
// 收集的状态
var sequenceNumber;
var currentWorkOffset;
var maximumClearanceHeight = -1;
var 缩回 = false;// 指定刀具已退回到安全平面
/**
写入指定块。
*/
function writeBlock() {
if (!formatWords(arguments)) {
返回;
}
if (properties.showSequenceNumbers) {
writeWords2(nFormat.format(sequenceNumber % 100000), arguments);
sequenceNumber += properties.sequenceNumberIncrement;
} else {
writeWords(参数);
}
}
/**
输出注释。
*/
function writeComment(text) {
writeln(“(” + filterText(String(text).toUpperCase(), permittedCommentChars) + “)”);
}
function onOpen() {
if (properties.useRadius) {
maximumCircularSweep = toRad(90); // 避免 CNC 潜在的中心计算错误
}
如果 (!machineConfiguration.isMachineCoordinate(0)) {
aOutput.disable();
}
if (!machineConfiguration.isMachineCoordinate(1)) {
bOutput.disable();
}
if (!machineConfiguration.isMachineCoordinate(2)) {
cOutput.disable();
}
如果 (!properties.separateWordsWithSpace) {
setWordSeparator(“”);
}
sequenceNumber = properties.sequenceNumberStart;
如果(程序名){
writeComment(程序名);
}
if (programComment) {
writeComment(programComment);
}
// 转储机器配置
var vendor = machineConfiguration.getVendor();
var model = machineConfiguration.getModel();
var description = machineConfiguration.getDescription();
if (properties.writeMachine && (vendor || model || description)) {
writeComment(localize(“Machine”));
如果(供应商){
writeComment(” ” + localize(“供应商”) + “: ” + 供应商);
}
if (model) {
writeComment(” ” + localize(“model”) + “: ” + model);
}
if (description) {
writeComment(” ” + localize(“description”) + “: ” + description);
}
}
// 转储工具信息
if (properties.writeTools) {
var zRanges = {};
如果 (is3D()) {
var numberOfSections = getNumberOfSections();
对于 (var i = 0; i < numberOfSections; ++i) {
var section = getSection(i);
var zRange = section.getGlobalZRange();
var tool = section.getTool();
如果 (zRanges[tool.number]) {
zRanges[tool.number].expandToRange(zRange);
} else {
zRanges[tool.number] = zRange;
}
}
}
}
if (false) {
// 检查重复的工具编号
for (var i = 0; i < getNumberOfSections(); ++i) {
var sectioni = getSection(i);
var tooli = sectioni.getTool();
对于 (var j = i + 1; j < getNumberOfSections(); ++j) {
var sectionj = getSection(j);
var toolj = sectionj.getTool();
如果(tooli.number == toolj.number){
如果(xyzFormat.areDifferent(tooli.diameter,toolj.diameter)||
xyzFormat.areDifferent(tooli.cornerRadius,toolj.cornerRadius)||
abcFormat.areDifferent(tooli.taperAngle, toolj.taperAngle) ||
(tooli.numberOfFlutes != toolj.numberOfFlutes)) {
error(
subst(
localize(“对操作 ‘%1’ 和 ‘%2’ 的不同刀具几何形状使用相同的刀具编号。”),
sectioni.hasParameter(“operation-comment”) ? sectioni.getParameter(“operation-comment”) : (“#” + (i + 1)),
sectionj.hasParameter(“operation-comment”) ?sectionj.getParameter(“operation-comment”) : (“#” + (j + 1))
)
);
返回;
}
}
}
}
}
if ((getNumberOfSections() > 0) && (getSection(0).workOffset == 0)) {
for (var i = 0; i < getNumberOfSections(); ++i) {
if (getSection(i).workOffset > 0) {
error(localize(“如果初始工件偏移量为 0,则无法使用多个工件偏移量。”));
返回;
}
}
}
如果 (!properties.useG28) {
如果 (is3D()) {
var numberOfSections = getNumberOfSections();
对于 (var i = 0; i < numberOfSections; ++i) {
var section = getSection(i);
如果 (section.getGlobalZRange().getMaximum() > maximumClearanceHeight) {
maximumClearanceHeight = section.getGlobalZRange().getMaximum();
warning(localize(“缩回高度已更新。”));
}
if (i != 0 && getSection(i – 1).workOffset != section.workOffset) {
error(localize(“只有在使用相同的工件偏移量时才能使用退刀间隙高度。”));
返回;
}
}
} else {
error(localize(“只有 3 轴刀具路径才能使用退刀间隙高度。”));
返回;
}
}
// 绝对坐标和每分钟进给
writeBlock(gFormat.format(0), gAbsIncModal.format(90), gFeedModeModal.format(94), gPlaneModal.format(17));
switch (unit) {
case IN:
writeBlock(gUnitModal.format(20));
休息;
案例 MM:
writeBlock(gUnitModal.format(21));
休息;
}
}
function onComment(message) {
var comments = String(message).split(“;”);
对于(评论中的评论){
writeComment(评论[评论]);
}
}
/** 强制输出 X、Y 和 Z。 */
function forceXYZ() {
xOutput.reset();
yOutput.reset();
zOutput.reset();
}
/** 强制输出 A、B 和 C。 */
function forceABC() {
aOutput.reset();
bOutput.reset();
cOutput.reset();
}
/** 在下一次输出时强制输出 X、Y、Z、A、B、C 和 F。*/
function forceAny() {
forceXYZ();
强制ABC();
feedOutput.reset();
}
var currentWorkPlaneABC = undefined;
函数 forceWorkPlane() {
currentWorkPlaneABC = undefined;
}
function setWorkPlane(abc) {
if (!machineConfiguration.isMultiAxisConfiguration()) {
返回;// 忽略
}
如果 (!((currentWorkPlaneABC == undefined) ||
abcFormat.areDifferent(abc.x, currentWorkPlaneABC.x) ||
abcFormat.areDifferent(abc.y, currentWorkPlaneABC.y) ||
abcFormat.areDifferent(abc.z, currentWorkPlaneABC. z))) {
返回;// 没有变化
}
onCommand(COMMAND_UNLOCK_MULTI_AXIS);
如果(!缩回){
writeRetract(Z);
}
writeBlock(
gMotionModal.format(0),
条件(machineConfiguration.isMachineCoordinate(0),“A”+ abcFormat.format(abc.x)),
条件(machineConfiguration.isMachineCoordinate(1),“B”+ abcFormat.format(abc .y)),
条件(machineConfiguration.isMachineCoordinate(2), “C” + abcFormat.format(abc.z))
);
onCommand(COMMAND_LOCK_MULTI_AXIS);
当前工作平面ABC = abc;
}
var closestABC = false; // 选择最接近的机器角度
var currentMachineABC;
函数 getWorkPlaneMachineABC(workPlane) {
var W = workPlane; // 映射到全局框架
var abc = machineConfiguration.getABC(W);
如果 (closestABC) {
如果 (currentMachineABC) {
abc = machineConfiguration.remapToABC(abc, currentMachineABC);
} else {
abc = machineConfiguration.getPreferredABC(abc);
}
} else {
abc = machineConfiguration.getPreferredABC(abc);
}
try {
abc = machineConfiguration.remapABC(abc);
currentMachineABC = abc;
} catch (e) {
error(
localize(“Machine angles not supported”) + “:”
+ conditional(machineConfiguration.isMachineCoordinate(0), ” A” + abcFormat.format(abc.x))
+ conditional(machineConfiguration.isMachineCoordinate(1), ” B” + abcFormat.format(abc.y))
+ conditional(machineConfiguration.isMachineCoordinate(2), ” C” + abcFormat.format(abc.z))