From 5be46bff759c09b32a0db2cc16929b44524dd718 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 8 Mar 2021 11:08:53 -0500 Subject: [PATCH] add experimental Roland MDX-50 --- src/dev/cam/Any.Generic.LinuxCNC | 2 +- src/dev/cam/Roland.MDX-50 | 21 +++++++++++++++++++++ src/mode/cam/export.js | 20 +++++++++++++++++--- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 src/dev/cam/Roland.MDX-50 diff --git a/src/dev/cam/Any.Generic.LinuxCNC b/src/dev/cam/Any.Generic.LinuxCNC index e7ad43f9..b1406adf 100644 --- a/src/dev/cam/Any.Generic.LinuxCNC +++ b/src/dev/cam/Any.Generic.LinuxCNC @@ -8,7 +8,7 @@ "M03 S20000 ; spindle on" ], "post":[ - "M05 ; spindle off", + "M05 ; spindle off", "M30 ; program end" ], "tool-change":[ diff --git a/src/dev/cam/Roland.MDX-50 b/src/dev/cam/Roland.MDX-50 new file mode 100644 index 00000000..b9bbb820 --- /dev/null +++ b/src/dev/cam/Roland.MDX-50 @@ -0,0 +1,21 @@ +{ + "file-ext": "rml", + "token-space": "", + "strip-comments": true, + "pre":[ + "PA;PA;VS4;!VZ4;!PZ0,80;!MC1;" + ], + "post":[ + "PA;PA;!PZ0,2420;PU0,6096;!MC0;" + ], + "dwell":[ + "W{time};" + ], + "spindle": [ + "!RC{speed};" + ], + "settings": { + "bed_width": 400, + "bed_depth": 305 + } +} diff --git a/src/mode/cam/export.js b/src/mode/cam/export.js index b914d21a..fbd13fec 100644 --- a/src/mode/cam/export.js +++ b/src/mode/cam/export.js @@ -31,6 +31,7 @@ gcodes = settings.device || {}, tools = settings.tools, space = gcodes.gcodeSpace ? ' ' : '', + isRML = device.gcodeFExt.toLowerCase() === 'rml', stripComments = gcodes.gcodeStrip || false, cmdToolChange = gcodes.gcodeChange || [ "M6 T{tool}" ], cmdSpindle = gcodes.gcodeSpindle || [ "M3 S{speed}" ], @@ -88,7 +89,7 @@ if (!array) return; for (i=0; i= 0) { + if (!isRML && stripComments && (cidx = line.indexOf(";")) >= 0) { line = line.substring(0, cidx).trim(); if (line.length === 0) continue; } @@ -179,7 +180,8 @@ dz = newpos.z - pos.z, maxf = dz ? maxZd : maxXYd, feed = Math.min(speed || maxf, maxf), - dist = Math.sqrt(dx * dx + dy * dy + dz * dz); + dist = Math.sqrt(dx * dx + dy * dy + dz * dz), + newFeed = feed && feed !== pos.f; // drop dup points (all deltas are 0) if (!(dx || dy || dz)) { @@ -204,11 +206,23 @@ runbox.max.z = Math.max(runbox.max.z, pos.z); nl.append(space).append("Z").append(add0(pos.z * factor)); } - if (feed && feed !== pos.f) { + if (newFeed) { pos.f = feed; nl.append(space).append("F").append(add0(feed * factor, true)); } + // temp hack to support RML1 dialect from a file extensions trigger + if (isRML) { + if (speed) { + if (newFeed) { + append(`VS${feed};`); + } + nl = [ "Z", add0(pos.x * factor), ",", add0(pos.y * factor), ",", add0(pos.z * factor), ";" ]; + } else { + nl = [ "PU", add0(pos.x * factor), ",", add0(pos.y * factor), ";" ]; + } + } + // update time calculation time += (dist / (pos.f || 1000)) * 60;