add M808 looping regions and a UI for setting them
This commit is contained in:
parent
4b0ebe890d
commit
d6132fd652
4 changed files with 41 additions and 1 deletions
|
|
@ -332,6 +332,7 @@
|
|||
outputWipeDistance: 0,
|
||||
outputLayerRetract: false,
|
||||
outputOriginCenter: true,
|
||||
outputLoopLayers: "",
|
||||
outputInvertX: false,
|
||||
outputInvertY: false,
|
||||
detectThinWalls: false,
|
||||
|
|
|
|||
|
|
@ -1754,6 +1754,7 @@
|
|||
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM}),
|
||||
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
||||
gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, comma:true}),
|
||||
outputLoopLayers: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, modes:FDM, comma:true, show:isBelt}),
|
||||
outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM}),
|
||||
|
||||
// SLA
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
emitted = 0,
|
||||
retracted = 0,
|
||||
pos = {x:0, y:0, z:0, f:0},
|
||||
lout = null,
|
||||
last = null,
|
||||
zpos = 0,
|
||||
zhop = process.zHopDistance || 0,
|
||||
|
|
@ -77,13 +78,28 @@
|
|||
lines = 0,
|
||||
bytes = 0,
|
||||
bcos = Math.cos(Math.PI/4),
|
||||
icos = 1 / bcos;
|
||||
icos = 1 / bcos,
|
||||
loops = process.outputLoopLayers,
|
||||
inLoop;
|
||||
|
||||
if (isBelt && loops) {
|
||||
loops = loops.split(',').map(range => {
|
||||
return range.split('-').map(v => parseInt(v));
|
||||
}).filter(a => a.length > 1).map(a => {
|
||||
return { start:a[0], end:a[1], iter:a[2] >= 0 ? a[2] : 1}
|
||||
});
|
||||
}
|
||||
if (!isBelt || (loops && loops.length < 1)) {
|
||||
loops = undefined;
|
||||
}
|
||||
|
||||
(process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
||||
let v = parseInt(lv);
|
||||
if (v >= 0) pause.push(v);
|
||||
});
|
||||
|
||||
// console.log(loops)
|
||||
|
||||
append = function(line) {
|
||||
if (line) {
|
||||
lines++;
|
||||
|
|
@ -203,6 +219,7 @@
|
|||
epos.x = originCenter ? -pos.x : device.bedWidth - pos.x;
|
||||
epos.z = pos.z * icos;
|
||||
epos.y = -pos.y + epos.z * bcos;
|
||||
lout = epos;
|
||||
}
|
||||
if (emit.x) o.append(" X").append(epos.x.toFixed(decimals));
|
||||
if (emit.y) o.append(" Y").append(epos.y.toFixed(decimals));
|
||||
|
|
@ -251,6 +268,7 @@
|
|||
|
||||
subst.z = zpos = path.z;
|
||||
subst.Z = subst.z;
|
||||
subst.e = subst.E = outputLength;
|
||||
subst.layer = layer;
|
||||
subst.height = path.height.toFixed(3);
|
||||
|
||||
|
|
@ -262,6 +280,24 @@
|
|||
appendAllSub(pauseCmd)
|
||||
}
|
||||
|
||||
if (loops) {
|
||||
if (inLoop) {
|
||||
if (layer === inLoop.end) {
|
||||
append(`M808`);
|
||||
inLoop = undefined;
|
||||
}
|
||||
} else {
|
||||
for (let loop of loops) {
|
||||
if (layer === loop.start) {
|
||||
append(`M808 L${loop.iter}`);
|
||||
append(`G92 Z${lout.z.round(decimals)} E${outputLength.round(decimals)}`);
|
||||
inLoop = loop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gcodeLayer && gcodeLayer.length) {
|
||||
appendAllSub(gcodeLayer);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -496,6 +496,8 @@ kiri.lang['en-us'] = {
|
|||
ag_nozl_l: "select output nozzle or head",
|
||||
ag_paws_s: "pause layers",
|
||||
ag_paws_l: "comma-separated list of layers\nto inject pause commands before",
|
||||
ag_loop_s: "loop layers",
|
||||
ag_loop_l: "layer ranges to repeat in the format\nfirst-last-count,first-last-count,...\nomitted count = 1",
|
||||
|
||||
// SLA MENU
|
||||
sa_menu: "slicing",
|
||||
|
|
|
|||
Loading…
Reference in a new issue