From 7d7fe224b6f90949e7087d8199e8a342d30c9e9f Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 6 Mar 2022 11:14:33 -0500 Subject: [PATCH] updates to raft generation: border, faster connected infill --- notes.md | 1 + release.md | 1 + src/kiri-mode/fdm/prepare.js | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/notes.md b/notes.md index 90ad9ac8..800aa21f 100644 --- a/notes.md +++ b/notes.md @@ -77,6 +77,7 @@ * `F` roughing flats should be constrained to flat region * `F` limit cut depth to flute length of selected tool (or warn) * `F` add ease-down support to trace op +* `F` change color of line selection in trace op when not a closed poly * `F` add linear clearing strategy * `F` add adaptive clearing strategy * `F` user-defined origin (issue #28) diff --git a/release.md b/release.md index d4054b8a..1f6f538d 100644 --- a/release.md +++ b/release.md @@ -25,6 +25,7 @@ * `C` add parameterized solid projection expansion (infill -> solid expand) * `C` add parameterized control of bridge/flat and infill print speeds * `C` add api control over threading workloads and use of wasm +* `C` updates to raft generation: add border, connect infill lines * `P` template vars: nozzles used and layers until next use (IDEX) * `-` improved vertex replacement and widget update matrix tracking diff --git a/src/kiri-mode/fdm/prepare.js b/src/kiri-mode/fdm/prepare.js index ca9372cf..8326ed84 100644 --- a/src/kiri-mode/fdm/prepare.js +++ b/src/kiri-mode/fdm/prepare.js @@ -775,7 +775,6 @@ FDM.prepare = function(widgets, settings, update) { return print.render; }; -// fdm only function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { const { settings } = print; const { device } = settings; @@ -1141,9 +1140,10 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { start = 0, skip = false, lastIndex = -1, + raft = opt.raft || false, flow = opt.flow || 1, near = opt.near || false, - fast = opt.fast || false, + fast = opt.fast || raft || false, fill = (opt.fill >= 0 ? opt.fill : fillMult) * flow, thinDist = near ? thinWall : thinWall; @@ -1234,6 +1234,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { } skip = false; + // re-seek a new start index within fill array + let restart = lastIndex < 0; + // mark as used (temporarily) p1.del = true; p2.del = true; @@ -1262,6 +1265,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { // bridge ends of fill when they're close together if (dist < thinDist) { print.addOutput(preout, p1, fill, fillSpeed, extruder); + } else if (raft && !restart) { + // connect raft lines unless it's a restart + print.addOutput(preout, p1, fill, fillSpeed, extruder); } else { print.addOutput(preout, p1, 0, moveSpeed, extruder); } @@ -1328,7 +1334,7 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { let out = []; if (slice.tops) { out.appendAll(slice.tops); - }; + } if (opt.support && slice.supports) { out.appendAll(slice.supports); } @@ -1345,6 +1351,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { outputFills(next.fill, {fast: true}); } } else { + let top = next; + let isRaft = top.traces && top.traces.length; + print.setType('shells'); if (lastTop && lastTop !== next) { retract(); @@ -1369,6 +1378,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { } } + // raft + if (isRaft) outputTraces(top.traces); + // innermost shells let inner = next.innerShells() || []; @@ -1386,7 +1398,7 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { // then output solid and sparse fill print.setType('solid fill'); - outputFills(next.fill_lines, {flow: fillMult}); + outputFills(next.fill_lines, { flow: fillMult, raft: isRaft }); print.setType('sparse infill'); outputSparse(next.fill_sparse, sparseMult, infillSpeed);