loops are now set in ranges much more intuitively
This commit is contained in:
parent
02851d19a6
commit
a20ba0a163
8 changed files with 59 additions and 22 deletions
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
if (!self.kiri) {
|
||||
self.kiri = {
|
||||
beta: 2901,
|
||||
beta: 2902,
|
||||
driver: {}, // driver modules
|
||||
loader: [] // module loading: array of functions
|
||||
};
|
||||
|
|
|
|||
|
|
@ -345,6 +345,7 @@
|
|||
outputLayerRetract: false,
|
||||
outputOriginCenter: true,
|
||||
outputLoopLayers: "",
|
||||
outputLoops: 0,
|
||||
outputPeelGuard: 0,
|
||||
outputInvertX: false,
|
||||
outputInvertY: false,
|
||||
|
|
|
|||
|
|
@ -1802,7 +1802,8 @@
|
|||
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
|
||||
outputPeelGuard: UC.newInput(LANG.ag_peel_s, {title:LANG.ag_peel_l, convert:UC.toInt, modes:FDM, comma:true, show:isBelt}),
|
||||
gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, comma:true, show:isNotBelt}),
|
||||
outputLoopLayers: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, modes:FDM, comma:true, show:isBelt}),
|
||||
// outputLoopLayers: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, modes:FDM, comma:true, show:isBelt}),
|
||||
outputLoops: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, convert:UC.toInt, bound:UC.bound(0,1000), modes:FDM, show:isBelt}),
|
||||
outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM}),
|
||||
outputPurgeTower: UC.newBoolean(LANG.ad_purg_s, onBooleanClick, {title:LANG.ad_purg_l, modes:FDM, show:isMultiHead}),
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
let terms = {
|
||||
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||
LICENSE: "See the license.md file included with the source distribution",
|
||||
VERSION: "2.9.D1"
|
||||
VERSION: "2.9.D2"
|
||||
};
|
||||
|
||||
if (typeof(module) === 'object') {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
"outputShortPoly": LANG.ad_spol_s,
|
||||
"outputMinSpeed": LANG.ad_mins_s,
|
||||
"outputCoastDist": LANG.ad_scst_s,
|
||||
"outputLoops": LANG.ag_loop_s,
|
||||
"sliceSupportDensity": LANG.sp_dens_s,
|
||||
"sliceSupportOffset": LANG.sp_offs_s,
|
||||
"sliceLayerStart": LANG.sl_strt_s,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
extrudeSet = false,
|
||||
time = 0,
|
||||
layer = 0,
|
||||
layerno = 0,
|
||||
pause = [],
|
||||
pauseCmd = device.gcodePause,
|
||||
output = [],
|
||||
|
|
@ -51,7 +52,8 @@
|
|||
blast = 0,
|
||||
blastz = 0,
|
||||
process = settings.process,
|
||||
loops = process.outputLoopLayers,
|
||||
// loops = process.outputLoopLayers,
|
||||
loops = process.outputLoops || 0,
|
||||
zhop = process.zHopDistance || 0, // range
|
||||
seekMMM = process.outputSeekrate * 60,
|
||||
retDist = process.outputRetractDist || 0, // range
|
||||
|
|
@ -128,20 +130,41 @@
|
|||
});
|
||||
}
|
||||
|
||||
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] ? a[1] + 1 : Infinity,
|
||||
iter: a[2] >= 0 ? a[2] : 1
|
||||
}
|
||||
// collect loops from ranges and synth range array
|
||||
let rloops = [];
|
||||
if (loops > 0) {
|
||||
rloops.push({
|
||||
start: layers[0].slice.index,
|
||||
end: layers.last().slice.index,
|
||||
iter: loops - 1
|
||||
});
|
||||
}
|
||||
if (!isBelt || (loops && loops.length < 1)) {
|
||||
loops = undefined;
|
||||
for (let range of process.ranges) {
|
||||
console.log({range});
|
||||
if (range.fields.outputLoops) {
|
||||
rloops.push({
|
||||
start: range.lo,
|
||||
end: range.hi,
|
||||
iter: range.fields.outputLoops - 1
|
||||
});
|
||||
}
|
||||
}
|
||||
loops = isBelt && rloops.length ? rloops : undefined;
|
||||
|
||||
// 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] ? a[1] + 1 : Infinity,
|
||||
// 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);
|
||||
|
|
@ -333,6 +356,7 @@
|
|||
|
||||
while (layer < layers.length) {
|
||||
path = layers[layer];
|
||||
layerno = path.slice.index;
|
||||
|
||||
// range overrides
|
||||
if (path.layer >= 0) {
|
||||
|
|
@ -366,15 +390,17 @@
|
|||
appendAllSub(pauseCmd)
|
||||
}
|
||||
|
||||
let endloop = false;
|
||||
if (loops) {
|
||||
if (inLoop) {
|
||||
if (layer === inLoop.end) {
|
||||
append(`M808`);
|
||||
inLoop = undefined;
|
||||
if (layerno === inLoop.end) {
|
||||
endloop = true;
|
||||
// append(`M808`);
|
||||
// inLoop = undefined;
|
||||
}
|
||||
} else {
|
||||
for (let loop of loops) {
|
||||
if (layer === loop.start) {
|
||||
if (layerno === loop.start) {
|
||||
append(`M808 L${loop.iter}`);
|
||||
if (extrudeAbs) {
|
||||
append(`G92 Z${lout.z.round(decimals)} E${outputLength.round(decimals)}`);
|
||||
|
|
@ -556,6 +582,12 @@
|
|||
laste = out.emit;
|
||||
}
|
||||
layer++;
|
||||
|
||||
// end open loop when detected
|
||||
if (endloop) {
|
||||
append(`M808`);
|
||||
inLoop = undefined;
|
||||
}
|
||||
}
|
||||
drainQ();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue