From d5b9d5d8f731fc4b9ae3701c1035d42702c50ae1 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 21 Sep 2025 01:13:13 -0400 Subject: [PATCH] test output using point radius for extrusion width --- src/kiri/mode/fdm/prepare.js | 21 +++++++++++++++++++-- src/kiri/mode/fdm/slice.js | 10 +++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/kiri/mode/fdm/prepare.js b/src/kiri/mode/fdm/prepare.js index c7a90638..455f5250 100644 --- a/src/kiri/mode/fdm/prepare.js +++ b/src/kiri/mode/fdm/prepare.js @@ -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 || []; diff --git a/src/kiri/mode/fdm/slice.js b/src/kiri/mode/fdm/slice.js index fb854b9b..32cb2f52 100644 --- a/src/kiri/mode/fdm/slice.js +++ b/src/kiri/mode/fdm/slice.js @@ -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 }));