fdm rendering patchups
This commit is contained in:
parent
9a3cf79c8b
commit
df6afeeebb
3 changed files with 53 additions and 41 deletions
|
|
@ -111,6 +111,11 @@
|
||||||
return this.tops.map(top => top.poly);
|
return this.tops.map(top => top.poly);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// CAM only
|
||||||
|
PRO.topPolyInners = function() {
|
||||||
|
return this.tops.map(top => top.poly.inner).flat().filter(poly => poly);
|
||||||
|
};
|
||||||
|
|
||||||
// FDM / SLA only
|
// FDM / SLA only
|
||||||
PRO.topInners = function() {
|
PRO.topInners = function() {
|
||||||
return this.tops.map(top => top.last).flat().filter(poly => poly);
|
return this.tops.map(top => top.last).flat().filter(poly => poly);
|
||||||
|
|
|
||||||
|
|
@ -361,7 +361,7 @@
|
||||||
// for each slice, look for polygons with 98.5% circularity whose
|
// for each slice, look for polygons with 98.5% circularity whose
|
||||||
// area is within the tolerance of a circle matching the tool diameter
|
// area is within the tolerance of a circle matching the tool diameter
|
||||||
slices.forEach(function(slice) {
|
slices.forEach(function(slice) {
|
||||||
let inner = slice.gatherTopPolyInners([]);
|
let inner = slice.topPolyInners([]);
|
||||||
inner.forEach(function(poly) {
|
inner.forEach(function(poly) {
|
||||||
if (poly.circularity() >= 0.985 && Math.abs(poly.area() - area) <= areaDelta) {
|
if (poly.circularity() >= 0.985 && Math.abs(poly.area() - area) <= areaDelta) {
|
||||||
let center = poly.circleCenter(),
|
let center = poly.circleCenter(),
|
||||||
|
|
|
||||||
|
|
@ -159,19 +159,9 @@
|
||||||
}, "solids");
|
}, "solids");
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculations only relevant when supports are enabled
|
|
||||||
if (supportEnabled) {
|
|
||||||
forSlices(0.5, 0.7, function(slice) {
|
|
||||||
if (slice.index > 0) doSupport(slice, spro.sliceSupportOffset, spro.sliceSupportSpan, spro.sliceSupportExtra, supportMinArea, spro.sliceSupportSize, spro.sliceSupportOffset, spro.sliceSupportGap);
|
|
||||||
}, "support");
|
|
||||||
forSlices(0.7, 0.8, function(slice) {
|
|
||||||
doSupportFill(slice, nozzleSize, spro.sliceSupportDensity, supportMinArea);
|
|
||||||
}, "support");
|
|
||||||
}
|
|
||||||
|
|
||||||
// sparse layers only present when non-vase mose and sparse % > 0
|
// sparse layers only present when non-vase mose and sparse % > 0
|
||||||
if (!vaseMode && spro.sliceFillSparse > 0.0) {
|
if (!vaseMode && spro.sliceFillSparse > 0.0) {
|
||||||
forSlices(0.8, 1.0, function(slice) {
|
forSlices(0.5, 0.7, function(slice) {
|
||||||
doSparseLayerFill(slice, {
|
doSparseLayerFill(slice, {
|
||||||
settings: settings,
|
settings: settings,
|
||||||
process: spro,
|
process: spro,
|
||||||
|
|
@ -186,6 +176,16 @@
|
||||||
}, "infill");
|
}, "infill");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculations only relevant when supports are enabled
|
||||||
|
if (supportEnabled) {
|
||||||
|
forSlices(0.7, 0.9, function(slice) {
|
||||||
|
if (slice.index > 0) doSupport(slice, spro.sliceSupportOffset, spro.sliceSupportSpan, spro.sliceSupportExtra, supportMinArea, spro.sliceSupportSize, spro.sliceSupportOffset, spro.sliceSupportGap);
|
||||||
|
}, "support");
|
||||||
|
forSlices(0.9, 1.0, function(slice) {
|
||||||
|
doSupportFill(slice, nozzleSize, spro.sliceSupportDensity, supportMinArea);
|
||||||
|
}, "support");
|
||||||
|
}
|
||||||
|
|
||||||
// let polish = spro.polishLayers;
|
// let polish = spro.polishLayers;
|
||||||
// // experimental polishing
|
// // experimental polishing
|
||||||
// if (polish) {
|
// if (polish) {
|
||||||
|
|
@ -501,15 +501,19 @@
|
||||||
top.last = last;
|
top.last = last;
|
||||||
|
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer('shells', { face: 0x0000aa, line: 0x0000aa })
|
.setLayer("shells", { face: 0x0000aa, line: 0x0000aa })
|
||||||
.addPolys(top.shells, thin({ offset: offset1 }))
|
.addPolys(top.shells, thin({ offset: offset1 }));
|
||||||
.setLayer('slice', { face: 0, line: 0x888800 })
|
|
||||||
.addPolys(top.poly)
|
// if (isThin && debug) {
|
||||||
.setLayer('offset', { face: 0, line: 0x888888 })
|
// slice.output()
|
||||||
.addPolys(top.fill_off)
|
// .setLayer('slice', { face: 0, line: 0x888800 })
|
||||||
.setLayer('last', { face: 0, line: 0x008888 })
|
// .addPolys(top.poly)
|
||||||
.addPolys(top.last)
|
// .setLayer('offset', { face: 0, line: 0x888888 })
|
||||||
;
|
// .addPolys(top.fill_off)
|
||||||
|
// .setLayer('last', { face: 0, line: 0x008888 })
|
||||||
|
// .addPolys(top.last)
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -533,7 +537,7 @@
|
||||||
const lines = fillArea(top.fill_off, angle, spacing, null);
|
const lines = fillArea(top.fill_off, angle, spacing, null);
|
||||||
top.fill_lines.appendAll(lines);
|
top.fill_lines.appendAll(lines);
|
||||||
render
|
render
|
||||||
.setLayer('fill', { face: 0x0000aa, line: 0x0000aa })
|
.setLayer("fill", { face: 0x0000aa, line: 0x0000aa })
|
||||||
.addLines(lines, thin({ offset: spacing/2 }));
|
.addLines(lines, thin({ offset: spacing/2 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -621,7 +625,7 @@
|
||||||
function ondone() {
|
function ondone() {
|
||||||
tops.forEach(top => {
|
tops.forEach(top => {
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer('infill', { face: 0x0000aa, line: 0x0000aa })
|
.setLayer("infill", { face: 0x0000aa, line: 0x0000aa })
|
||||||
.addPolys(top.fill_sparse, thin({ offset: spacing/2 }))
|
.addPolys(top.fill_sparse, thin({ offset: spacing/2 }))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -739,13 +743,15 @@
|
||||||
|
|
||||||
POLY.subtract(topInner, downInner, bridges, flats, slice.z, minArea);
|
POLY.subtract(topInner, downInner, bridges, flats, slice.z, minArea);
|
||||||
|
|
||||||
top.output()
|
// if (isThin && debug) {
|
||||||
.setLayer('bridges', { face: 0x00aaaa, line: 0x00aaaa })
|
// top.output()
|
||||||
.addAreas(bridges)
|
// .setLayer("bridges", { face: 0x00aaaa, line: 0x00aaaa })
|
||||||
|
// .addAreas(bridges)
|
||||||
down.output()
|
//
|
||||||
.setLayer('flats', { face: 0xaa00aa, line: 0xaa00aa })
|
// down.output()
|
||||||
.addAreas(flats)
|
// .setLayer("flats", { face: 0xaa00aa, line: 0xaa00aa })
|
||||||
|
// .addAreas(flats)
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -829,7 +835,9 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// emit solid areas
|
// emit solid areas
|
||||||
render.setLayer("solids", { face: 0x00dd00 }).addAreas(solids);
|
// if (isThin && debug) {
|
||||||
|
// render.setLayer("solids", { face: 0x00dd00 }).addAreas(solids);
|
||||||
|
// }
|
||||||
|
|
||||||
// for SLA to bypass line infill
|
// for SLA to bypass line infill
|
||||||
if (isSLA) {
|
if (isSLA) {
|
||||||
|
|
@ -865,7 +873,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
top.fill_lines.appendAll(newfill);
|
top.fill_lines.appendAll(newfill);
|
||||||
render.setLayer("fill", { line: 0, face: 0 }).addLines(newfill);
|
render
|
||||||
|
.setLayer("fill", { line: 0x003399, face: 0x003399 })
|
||||||
|
.addLines(newfill, thin({ offset: 0.2 }));
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -996,9 +1006,6 @@
|
||||||
// new bridge polys for next pass (skip first layer below)
|
// new bridge polys for next pass (skip first layer below)
|
||||||
if (depth >= gap) {
|
if (depth >= gap) {
|
||||||
down.supports.appendAll(culled);
|
down.supports.appendAll(culled);
|
||||||
// down.output()
|
|
||||||
// .setLayer("support", { line: 0xff0000 })
|
|
||||||
// .addPolys(culled, thin({ offset: 0.4 }))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
supports = culled;
|
supports = culled;
|
||||||
|
|
@ -1047,11 +1054,11 @@
|
||||||
let inset = POLY.offset([poly], -linewidth/3, {flat: true, z: slice.z});
|
let inset = POLY.offset([poly], -linewidth/3, {flat: true, z: slice.z});
|
||||||
// do the fill
|
// do the fill
|
||||||
if (inset.length > 0) {
|
if (inset.length > 0) {
|
||||||
fillArea(inset, angle, spacing, poly.fills = []);
|
fillArea(inset, angle, spacing, poly.fill = []);
|
||||||
if (poly.fills.length);
|
if (poly.fill.length);
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer("support", { line: 0xff0000 })
|
.setLayer("support", { line: 0xaa0000, face: 0xaa0000 })
|
||||||
.addLines(poly.fills, thin({ offset: 0.4 }))
|
.addLines(poly.fill, thin({ offset: 0.2 }))
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
@ -1060,8 +1067,8 @@
|
||||||
slice.supports = supports;
|
slice.supports = supports;
|
||||||
|
|
||||||
slice.output()
|
slice.output()
|
||||||
.setLayer("support", { line: 0xff0000 })
|
.setLayer("support", { line: 0xff0000, face: 0xff0000 })
|
||||||
.addPolys(supports, thin({ offset: 0.4 }))
|
.addPolys(supports, thin({ offset: 0.2 }))
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue