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 {
|
||||
// create top object from object bundle passed back by slicePost()
|
||||
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_sparse = data.fill_sparse;
|
||||
top.fill_off = data.fill_off;
|
||||
|
|
|
|||
|
|
@ -170,15 +170,14 @@ function thin_type_3(params) {
|
|||
let noodleWidth = offsetN * count;
|
||||
let { noodle, remain } = top.poly.noodle(noodleWidth);
|
||||
|
||||
// remaining area for infill after shells are extruded
|
||||
let gaps = top.gaps = remain;
|
||||
|
||||
// render inset "noodle"
|
||||
// shells.appendAll(noodle);
|
||||
|
||||
let thin = top.thin_fill = [];
|
||||
let shells = top.shells;
|
||||
let sparse = top.fill_sparse = [];
|
||||
let debugRemain = false;
|
||||
let debugExtrusion = false;
|
||||
|
||||
let shells = top.shells; // only used for debug
|
||||
let trace = top.thin_wall = [];
|
||||
|
||||
let midR = offsetN * 0.5; // nominal extrusion 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 polys = [];
|
||||
let trace = [];
|
||||
|
||||
for (let i=0; i<count; i++) {
|
||||
let remain = [];
|
||||
|
|
@ -211,7 +209,7 @@ function thin_type_3(params) {
|
|||
});
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
|
@ -219,15 +217,17 @@ function thin_type_3(params) {
|
|||
// console.log({ lines, polys, trace });
|
||||
|
||||
// show extrusion
|
||||
if (debugExtrusion)
|
||||
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);
|
||||
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
|
||||
|
|
@ -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 });
|
||||
break;
|
||||
}
|
||||
last = ret.last || last;
|
||||
gaps = ret.gaps || gaps;
|
||||
last = ret.last ?? last;
|
||||
gaps = ret.gaps ?? gaps;
|
||||
}
|
||||
} else {
|
||||
// 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)
|
||||
.addPolys(top.shells || [], vopt({ offset, height, clean: true }));
|
||||
|
||||
output
|
||||
if (top.fill_lines?.length) output
|
||||
.setLayer("solid fill", isSynth ? Color.support : Color.fill)
|
||||
.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)
|
||||
.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)
|
||||
.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)
|
||||
.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)
|
||||
.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()
|
||||
.setLayer('fill inset', Color.inset)
|
||||
.addPolys(top.fill_off);
|
||||
|
|
|
|||
Loading…
Reference in a new issue