add COMPACT-OUTPUT and DECIMALS directives in CAM gcode headers
This commit is contained in:
parent
07d1a0f5d2
commit
14226a19cb
1 changed files with 13 additions and 2 deletions
|
|
@ -47,14 +47,16 @@ CAM.export = function(print, online) {
|
||||||
spro = settings.process,
|
spro = settings.process,
|
||||||
maxZd = spro.camFastFeedZ,
|
maxZd = spro.camFastFeedZ,
|
||||||
maxXYd = spro.camFastFeed,
|
maxXYd = spro.camFastFeed,
|
||||||
decimals = base.config.gcode_decimals || 4,
|
decimals = base.config.gcode_decimals || 3,
|
||||||
pos = { x:null, y:null, z:null, a:undefined, f:null, t:null, emit:null },
|
pos = { x:null, y:null, z:null, a:undefined, f:null, t:null, emit:null },
|
||||||
line,
|
line,
|
||||||
cidx,
|
cidx,
|
||||||
mode,
|
mode,
|
||||||
point,
|
point,
|
||||||
points = 0,
|
points = 0,
|
||||||
|
lastGn = '',
|
||||||
rewrite_comments = false,
|
rewrite_comments = false,
|
||||||
|
compact_output = false,
|
||||||
lasering = false,
|
lasering = false,
|
||||||
laserOp,
|
laserOp,
|
||||||
stock = settings.stock || { },
|
stock = settings.stock || { },
|
||||||
|
|
@ -249,7 +251,8 @@ CAM.export = function(print, online) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let speed = out.speed,
|
let speed = out.speed,
|
||||||
nl = [speed ? 'G1' : 'G0'],
|
gn = speed ? 'G1' : 'G0',
|
||||||
|
nl = (compact_output && lastGn === gn) ? [] : [gn],
|
||||||
dx = opt.dx || newpos.x - pos.x,
|
dx = opt.dx || newpos.x - pos.x,
|
||||||
dy = opt.dy || newpos.y - pos.y,
|
dy = opt.dy || newpos.y - pos.y,
|
||||||
dz = opt.dz || newpos.z - pos.z,
|
dz = opt.dz || newpos.z - pos.z,
|
||||||
|
|
@ -263,6 +266,8 @@ CAM.export = function(print, online) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastGn = gn;
|
||||||
|
|
||||||
if (dx || newpos.x !== pos.x) {
|
if (dx || newpos.x !== pos.x) {
|
||||||
pos.x = newpos.x;
|
pos.x = newpos.x;
|
||||||
runbox.min.x = Math.min(runbox.min.x, pos.x);
|
runbox.min.x = Math.min(runbox.min.x, pos.x);
|
||||||
|
|
@ -351,6 +356,12 @@ CAM.export = function(print, online) {
|
||||||
}
|
}
|
||||||
} else if (line.indexOf(';; REWRITE-COMMENTS-PARENS') === 0) {
|
} else if (line.indexOf(';; REWRITE-COMMENTS-PARENS') === 0) {
|
||||||
rewrite_comments = true;
|
rewrite_comments = true;
|
||||||
|
} else if (line.indexOf(';; DECMIALS') === 0) {
|
||||||
|
decimals = parseInt(line.split('=')[1].trim() || 3) || 3;
|
||||||
|
} else if (line.indexOf(';; COMPACT-OUTPUT') === 0) {
|
||||||
|
compact_output = true;
|
||||||
|
stripComments = true;
|
||||||
|
space = '';
|
||||||
} else {
|
} else {
|
||||||
gcodePre.push(line);
|
gcodePre.push(line);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue