start passing back thin wall data to slice
This commit is contained in:
parent
e55a8328e3
commit
3568cd8497
3 changed files with 26 additions and 21 deletions
|
|
@ -144,7 +144,8 @@ class Slice {
|
||||||
} else {
|
} else {
|
||||||
// create top object from object bundle passed back by slicePost()
|
// create top object from object bundle passed back by slicePost()
|
||||||
let top = new Top(data.poly);
|
let top = new Top(data.poly);
|
||||||
top.thin_fill = data.thin_fill ? data.thin_fill.map(p => newPoint(p.x,p.y,p.z)) : undefined;
|
top.thin_fill = data.thin_fill?.map(p => newPoint(p.x,p.y,p.z));
|
||||||
|
top.thin_wall = data.thin_wall;
|
||||||
top.fill_lines = data.fill_lines;
|
top.fill_lines = data.fill_lines;
|
||||||
top.fill_sparse = data.fill_sparse;
|
top.fill_sparse = data.fill_sparse;
|
||||||
top.fill_off = data.fill_off;
|
top.fill_off = data.fill_off;
|
||||||
|
|
|
||||||
|
|
@ -170,15 +170,14 @@ function thin_type_3(params) {
|
||||||
let noodleWidth = offsetN * count;
|
let noodleWidth = offsetN * count;
|
||||||
let { noodle, remain } = top.poly.noodle(noodleWidth);
|
let { noodle, remain } = top.poly.noodle(noodleWidth);
|
||||||
|
|
||||||
// remaining area for infill after shells are extruded
|
|
||||||
let gaps = top.gaps = remain;
|
|
||||||
|
|
||||||
// render inset "noodle"
|
// render inset "noodle"
|
||||||
// shells.appendAll(noodle);
|
// shells.appendAll(noodle);
|
||||||
|
|
||||||
let thin = top.thin_fill = [];
|
let debugRemain = false;
|
||||||
let shells = top.shells;
|
let debugExtrusion = false;
|
||||||
let sparse = top.fill_sparse = [];
|
|
||||||
|
let shells = top.shells; // only used for debug
|
||||||
|
let trace = top.thin_wall = [];
|
||||||
|
|
||||||
let midR = offsetN * 0.5; // nominal extrusion width
|
let midR = offsetN * 0.5; // nominal extrusion width
|
||||||
let minR = midR * 0.75; // smallest interior fill or single wall width
|
let minR = midR * 0.75; // smallest interior fill or single wall width
|
||||||
|
|
@ -187,7 +186,6 @@ function thin_type_3(params) {
|
||||||
|
|
||||||
let lines = [];
|
let lines = [];
|
||||||
let polys = [];
|
let polys = [];
|
||||||
let trace = [];
|
|
||||||
|
|
||||||
for (let i=0; i<count; i++) {
|
for (let i=0; i<count; i++) {
|
||||||
let remain = [];
|
let remain = [];
|
||||||
|
|
@ -211,7 +209,7 @@ function thin_type_3(params) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// show remaining noodle after single trace
|
// show remaining noodle after single trace
|
||||||
// shells.push(...POLY.setZ(POLY.flatten(remain), z));
|
if (debugRemain) polys.push(...POLY.setZ(POLY.flatten(remain), z));
|
||||||
|
|
||||||
noodle = remain;
|
noodle = remain;
|
||||||
}
|
}
|
||||||
|
|
@ -219,15 +217,17 @@ function thin_type_3(params) {
|
||||||
// console.log({ lines, polys, trace });
|
// console.log({ lines, polys, trace });
|
||||||
|
|
||||||
// show extrusion
|
// show extrusion
|
||||||
|
if (debugExtrusion)
|
||||||
for (let point of trace) {
|
for (let point of trace) {
|
||||||
shells.push(newPolygon().centerCircle(point, point.r, 12).setZ(z));
|
polys.push(newPolygon().centerCircle(point, point.r, 12).setZ(z));
|
||||||
}
|
}
|
||||||
|
|
||||||
POLY.setZ([...lines, ...polys], z);
|
POLY.setZ([...lines, ...polys], z);
|
||||||
thin.push(...lines);
|
|
||||||
shells.push(...polys);
|
|
||||||
|
|
||||||
return { trace, gaps };
|
if (lines.length) top.thin_fill = lines;
|
||||||
|
if (polys.length) shells.push(...polys);
|
||||||
|
|
||||||
|
return { trace, last: remain };
|
||||||
}
|
}
|
||||||
|
|
||||||
// trace a single extrusion line around the inside of the noodle poly
|
// trace a single extrusion line around the inside of the noodle poly
|
||||||
|
|
@ -577,8 +577,8 @@ export function doTopShells(z, top, count, offset1, offsetN, fillOffset, opt = {
|
||||||
ret = offset_default({ z, top, count, top_poly, offset1, offsetN, wasm });
|
ret = offset_default({ z, top, count, top_poly, offset1, offsetN, wasm });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
last = ret.last || last;
|
last = ret.last ?? last;
|
||||||
gaps = ret.gaps || gaps;
|
gaps = ret.gaps ?? gaps;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// no shells, just infill, is permitted
|
// no shells, just infill, is permitted
|
||||||
|
|
|
||||||
|
|
@ -1001,27 +1001,31 @@ function doRender(slice, isSynth, params, opt = {}) {
|
||||||
.setLayer(isSynth ? "support" : "shells", isSynth ? Color.support : Color.shell)
|
.setLayer(isSynth ? "support" : "shells", isSynth ? Color.support : Color.shell)
|
||||||
.addPolys(top.shells || [], vopt({ offset, height, clean: true }));
|
.addPolys(top.shells || [], vopt({ offset, height, clean: true }));
|
||||||
|
|
||||||
output
|
if (top.fill_lines?.length) output
|
||||||
.setLayer("solid fill", isSynth ? Color.support : Color.fill)
|
.setLayer("solid fill", isSynth ? Color.support : Color.fill)
|
||||||
.addLines(top.fill_lines || [], vopt({ offset: offset * solidWidth, height, z:slice.z }));
|
.addLines(top.fill_lines || [], vopt({ offset: offset * solidWidth, height, z:slice.z }));
|
||||||
|
|
||||||
if (!(slice.belt && slice.belt.anchor)) output
|
if (!(slice.belt?.anchor)) output
|
||||||
.setLayer("sparse fill", Color.infill)
|
.setLayer("sparse fill", Color.infill)
|
||||||
.addPolys(top.fill_sparse || [], vopt({ offset, height, outline: true, trace:true }))
|
.addPolys(top.fill_sparse || [], vopt({ offset, height, outline: true, trace:true }))
|
||||||
|
|
||||||
if (slice.belt && slice.belt.anchor) output
|
if (slice.belt?.anchor) output
|
||||||
.setLayer("anchor", Color.anchor)
|
.setLayer("anchor", Color.anchor)
|
||||||
.addPolys(top.fill_sparse || [], vopt({ offset, height, outline: true, trace:true }))
|
.addPolys(top.fill_sparse || [], vopt({ offset, height, outline: true, trace:true }))
|
||||||
|
|
||||||
if (top.thin_fill) output
|
if (top.thin_fill?.length) output
|
||||||
.setLayer("thin fill", Color.thin)
|
.setLayer("thin fill", Color.thin)
|
||||||
.addLines(top.thin_fill, vopt({ offset, height }));
|
.addLines(top.thin_fill, vopt({ offset, height }));
|
||||||
|
|
||||||
if (top.gaps && devel) output
|
if (top.thin_wall?.length) output
|
||||||
|
.setLayer("shells", Color.thin)
|
||||||
|
.addPolys(top.thin_wall.map(p => newPolygon().centerCircle(p, p.r, 12).setZ(slice.z)), vopt({ offset, height }));
|
||||||
|
|
||||||
|
if (top.gaps?.length && devel) output
|
||||||
.setLayer("gaps", Color.gaps)
|
.setLayer("gaps", Color.gaps)
|
||||||
.addPolys(top.gaps, vopt({ offset, height, thin: true }));
|
.addPolys(top.gaps, vopt({ offset, height, thin: true }));
|
||||||
|
|
||||||
if (isThin && devel && top.fill_off && top.fill_off.length) {
|
if (isThin && devel && top.fill_off?.length) {
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer('fill inset', Color.inset)
|
.setLayer('fill inset', Color.inset)
|
||||||
.addPolys(top.fill_off);
|
.addPolys(top.fill_off);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue