fix thin output start/end point tracking (which broke retraction) and add slice indices in xray mode

This commit is contained in:
Stewart Allen 2022-07-05 19:19:21 -04:00
commit 59950369e0
3 changed files with 8 additions and 3 deletions

View file

@ -1120,6 +1120,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
}
let first = points[0];
let last = first;
if (startPoint && startPoint.distTo2D(first) > thinWall && intersectsTop(startPoint, first)) {
retract();
}
print.addOutput(preout, first, 0, moveSpeed, extruder);
for (let p of order) {
let dist = last ? last.distTo2D(p) : 0;
@ -1128,11 +1131,12 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
print.addOutput(preout, p, 0, moveSpeed, extruder);
}
print.addOutput(preout, p, 1, fillSpeed, extruder);
last = p;
startPoint = last = p;
}
// close a circle
if (last && last.distTo2D(first) <= thinWall) {
print.addOutput(preout, first, 1, fillSpeed, extruder);
startPoint = first;
}
}

View file

@ -283,7 +283,6 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
for (let i=0; i<zi.length; i++) {
zi[i] = (zi[i] - zh[i] / 2).round(3);
}
console.log({zi});
return zi;
},
// slicer function (worker local or minion distributed)
@ -304,6 +303,7 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
slice.height = heights[slice.index];
slice.clips = clip;
if (process.xray) {
slice.index = process.xrayi.shift();
slice.lines = lines;
slice.groups = groups;
slice.xray = process.xray;
@ -441,7 +441,7 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
let range = slice.params;
let spaceMult = slice.index === 0 ? process.firstLayerLineMult || 1 : 1;
let isBottom = slice.index < process.sliceBottomLayers;
let isTop = slice.index > slices.length - process.sliceTopLayers - 1;
let isTop = process.sliceTopLayers && slice.index > slices.length - process.sliceTopLayers - 1;
let isDense = range.sliceFillSparse > 0.995;
let isSolid = (isBottom || ((isTop || isDense) && !vaseMode)) && !isSynth;
let solidWidth = isSolid ? range.sliceFillWidth || 1 : 0;

View file

@ -50,6 +50,7 @@ const devel = {
let base = (proc.firstSliceHeight || size);
layers = Array.isArray(layers) ? layers : [ layers ];
proc.xray = layers.map(l => raw ? l : base + l * size - size / 2);
proc.xrayi = layers.slice();
api.function.slice();
}
};