fix scarf/arc conflict and scarf z on export. add print remain time macro var
This commit is contained in:
parent
79a227d741
commit
77b4cce97a
5 changed files with 67 additions and 44 deletions
|
|
@ -59,7 +59,8 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
retSpeed = process.outputRetractSpeed * 60 || 1, // range
|
||||
retDwell = process.outputRetractDwell || 0, // range
|
||||
timeDwell = retDwell / 1000,
|
||||
arcDist = isBelt ? 0 : (process.arcTolerance || 0),
|
||||
scarfZ = process.outputScarfLength ? true : false,
|
||||
arcDist = isBelt || scarfZ ? 0 : (process.arcTolerance || 0),
|
||||
arcMin = 1,
|
||||
arcRes = 20,
|
||||
arcDev = 0.5,
|
||||
|
|
@ -113,7 +114,9 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
tool: tool,
|
||||
oid: '',
|
||||
oname: '',
|
||||
model_labels: model_labels.sort().join(',')
|
||||
model_labels: model_labels.sort().join(','),
|
||||
total_time: Math.ceil(print.total_time / 60),
|
||||
remain_time: Math.ceil(print.total_time / 60),
|
||||
},
|
||||
pidx, path, out, speedMMM, emitMM, emitPerMM, lastp, laste, dist,
|
||||
lines = 0,
|
||||
|
|
@ -527,6 +530,7 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
// retract before first move
|
||||
retract();
|
||||
|
||||
subst.remain_time = Math.ceil(print.total_time / 60);
|
||||
while (layer < layers.length) {
|
||||
path = layers[layer];
|
||||
layerno = path.slice.index;
|
||||
|
|
@ -600,7 +604,7 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
}
|
||||
|
||||
// move Z to layer height
|
||||
if (layer > 0 || !isBelt) {
|
||||
if (layer === 0 || ((layer > 0 || !isBelt) && !scarfZ)) {
|
||||
moveTo({z:zpos}, seekMMM);
|
||||
}
|
||||
|
||||
|
|
@ -783,12 +787,20 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
} else {
|
||||
// emitMM = emitPerMM * out.emit * dist;
|
||||
emitMM = extrudeMM(dist, emitPerMM, out.emit);
|
||||
moveTo({x:x, y:y, e:emitMM}, speedMMM);
|
||||
if (scarfZ) {
|
||||
moveTo({x, y, z:z + path.height/2, e:emitMM}, speedMMM);
|
||||
} else {
|
||||
moveTo({x, y, e:emitMM}, speedMMM);
|
||||
}
|
||||
emitted += emitMM;
|
||||
}
|
||||
} else {
|
||||
drainQ();
|
||||
moveTo({x:x, y:y}, seekMMM);
|
||||
if (scarfZ) {
|
||||
moveTo({x, y, z:z + path.height/2, e:emitMM}, speedMMM);
|
||||
} else {
|
||||
moveTo({x, y}, seekMMM);
|
||||
}
|
||||
// TODO disabling out of plane z moves until a better mechanism
|
||||
// can be built that doesn't rely on computed zpos from layer heights...
|
||||
// when making z moves (like polishing) allow slowdown vs fast seek
|
||||
|
|
@ -834,11 +846,13 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
append(`M808`);
|
||||
}
|
||||
drainQ();
|
||||
|
||||
print.total_time -= path.print_time;
|
||||
subst.remain_time = Math.ceil(print.total_time / 60);
|
||||
}
|
||||
|
||||
function emitQrec(rec) {
|
||||
let {e, x, y, dist, emitPerMM, speedMMM} = rec;
|
||||
// emitMM = emitPerMM * e * dist;
|
||||
emitMM = extrudeMM(dist, emitPerMM, e);
|
||||
moveTo({x:x, y:y, e:emitMM}, speedMMM);
|
||||
emitted += emitMM;
|
||||
|
|
@ -962,7 +976,6 @@ export function fdm_export(print, online, ondone, ondebug) {
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (inloops) {
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ export async function fdm_prepare(widgets, settings, update) {
|
|||
});
|
||||
layerout.z = zoff + height;
|
||||
layerout.height = height;
|
||||
layerout.print_time = printPoint.layer_time;
|
||||
output.append(layerout);
|
||||
|
||||
layerout = [];
|
||||
|
|
@ -196,7 +197,7 @@ export async function fdm_prepare(widgets, settings, update) {
|
|||
});
|
||||
});
|
||||
|
||||
print.addPrintPoints(preout, layerout, null);
|
||||
print.addPrintPoints(preout, layerout);
|
||||
|
||||
if (preout.length) {
|
||||
// retract between brims and print
|
||||
|
|
@ -472,6 +473,7 @@ export async function fdm_prepare(widgets, settings, update) {
|
|||
let lastOut;
|
||||
|
||||
print.zmax = zmax;
|
||||
print.total_time = 0;
|
||||
|
||||
// walk cake layers bottom up
|
||||
for (let layer of cake) {
|
||||
|
|
@ -574,6 +576,8 @@ export async function fdm_prepare(widgets, settings, update) {
|
|||
}
|
||||
}
|
||||
);
|
||||
layerout.print_time = printPoint.layer_time;
|
||||
print.total_time += printPoint.layer_time;
|
||||
print.setWidget(null);
|
||||
|
||||
lastOut = slice;
|
||||
|
|
@ -1084,6 +1088,7 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
|
|||
}
|
||||
} else {
|
||||
let finishShell = poly.depth === 0 && !firstLayer;
|
||||
let scarf = (slice.index > 0 && traceNo === 0 && z - startPoint?.z > 1e-3) ? scarfLength : 0;
|
||||
startPoint = print.polyPrintPath(poly, startPoint, preout, {
|
||||
accel: finishShell,
|
||||
ccw: opt.shell && process.outputAlternating && slice.index % 2,
|
||||
|
|
@ -1091,10 +1096,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
|
|||
extrude: numOrDefault(opt.extrude, shellMult),
|
||||
nozzleSize,
|
||||
rate: finishShell ? finishSpeed : printSpeed,
|
||||
scarf: (traceNo === 0 && z - startPoint?.z > 1e-3) ? scarfLength : 0,
|
||||
scarf,
|
||||
tool: extruder,
|
||||
wipe: process.outputWipeDistance || 0,
|
||||
onfirst: function(firstPoint) {
|
||||
onfirst: (firstPoint, preout) => {
|
||||
let from = seedPoint || startPoint;
|
||||
if (from.distTo2D(firstPoint) > retractDist) {
|
||||
if (intersectsTop(from, firstPoint)) {
|
||||
|
|
@ -1576,23 +1580,21 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
|
|||
|
||||
// adjust layer output speeds (by slowing them down)
|
||||
// if layer print time is less than minimum (required for cooling)
|
||||
if (minLayerTime) {
|
||||
let lp, td = 0, tt = 0;
|
||||
for (let p of preout) {
|
||||
if (!p.emit) continue;
|
||||
let mms = p.speed ?? 1;
|
||||
let dst = lp?.distTo2D(p.point) ?? 0;
|
||||
if (dst) {
|
||||
tt += (dst/mms);
|
||||
td += dst;
|
||||
}
|
||||
lp = p.point;
|
||||
let lp, td = 0, tt = 0;
|
||||
for (let p of preout) {
|
||||
if (!p.emit) continue;
|
||||
let mms = p.speed ?? 1;
|
||||
let dst = lp?.distTo2D(p.point) ?? 0;
|
||||
if (dst) {
|
||||
tt += (dst/mms);
|
||||
td += dst;
|
||||
}
|
||||
if (tt < minLayerTime) {
|
||||
let fact = tt / minLayerTime;
|
||||
for (let p of preout) {
|
||||
if (p.emit) p.speed *= fact;
|
||||
}
|
||||
lp = p.point;
|
||||
}
|
||||
if (minLayerTime && tt < minLayerTime) {
|
||||
let fact = tt / minLayerTime;
|
||||
for (let p of preout) {
|
||||
if (p.emit) p.speed *= fact;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1602,7 +1604,12 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
|
|||
}
|
||||
|
||||
// add offset points to total print
|
||||
print.addPrintPoints(preout, output, origin, extruder);
|
||||
print.addPrintPoints(preout, output);
|
||||
|
||||
return startPoint.add(offset);
|
||||
// create next layer start point and annotate
|
||||
// with print time for previous layer (hack to
|
||||
// avoid changing return signature rn)
|
||||
let newStart = startPoint.add(offset);
|
||||
newStart.layer_time = Math.max(tt, minLayerTime);
|
||||
return newStart;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue