test output using point radius for extrusion width

This commit is contained in:
Stewart Allen 2025-09-21 01:13:13 -04:00
commit d5b9d5d8f7
2 changed files with 24 additions and 7 deletions

View file

@ -3,7 +3,7 @@
import { base, util } from '../../../geo/base.js';
import { poly2polyEmit, tip2tipEmit } from '../../../geo/paths.js';
import { newBounds } from '../../../geo/bounds.js';
import { newPoint } from '../../../geo/point.js';
import { newPoint, Point } from '../../../geo/point.js';
import { newPolygon, Polygon } from '../../../geo/polygon.js';
import { polygons as POLY, fillArea } from '../../../geo/polygons.js';
import { newPrint } from '../../core/print.js';
@ -834,7 +834,7 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
z = slice.z,
lastPoly;
// support alternating shell order
// support alternating shell order
if (Math.abs(shellOrder) > 1 && slice.index % 2 === 1) {
shellOrder = -shellOrder;
}
@ -1089,6 +1089,20 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
}
}
function outputAdaptiveWalls(thin, opt = {}) {
let np;
for (let pt of thin) {
let { lastPoint, lastEmit } = print;
let { x, y, r } = pt;
np = new Point(x, y, z);
if (lastPoint && lastPoint.distTo2D(np) > retractDist) {
print.addOutput(preout, np, 0, moveSpeed);
} else {
print.addOutput(preout, np, (r * 2) / nozzleSize, printSpeed);
}
}
}
/**
* output sparse infill
* @param {Polygon[]} polys
@ -1444,6 +1458,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
// raft
if (top.traces) outputTraces(top.traces);
// thin wall v3
if (top.thin_wall) outputAdaptiveWalls(top.thin_wall);
// innermost shells
let inner = next.innerShells() || [];
let shells = next.shells || [];

View file

@ -997,10 +997,14 @@ function doRender(slice, isSynth, params, opt = {}) {
.setLayer('part', Color.part)
.addPolys([top.poly]);
output
if (top.shells?.length) output
.setLayer(isSynth ? "support" : "shells", isSynth ? Color.support : Color.shell)
.addPolys(top.shells || [], vopt({ offset, height, clean: true }));
if (top.thin_wall?.length) output
.setLayer("walls", Color.thin)
.addPolys(top.thin_wall.map(p => newPolygon().centerCircle(p, p.r, 12).setZ(slice.z)), vopt({ offset, height }));
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 }));
@ -1017,10 +1021,6 @@ function doRender(slice, isSynth, params, opt = {}) {
.setLayer("thin fill", Color.thin)
.addLines(top.thin_fill, vopt({ offset, height }));
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 }));