From 76fabfa7f5192b87dd9fd522f3dc5d1097655bcc Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Thu, 1 Jan 2026 22:43:35 -0500 Subject: [PATCH] arc notes. rm dead code --- src/kiri/core/print.js | 3 ++- src/kiri/mode/cam/prepare.js | 1 + src/kiri/mode/fdm/export.js | 17 ++++++----------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/kiri/core/print.js b/src/kiri/core/print.js index 17bdf87e..3b19b106 100644 --- a/src/kiri/core/print.js +++ b/src/kiri/core/print.js @@ -212,12 +212,13 @@ class Print { let { arc } = point; if (arc) { arcInfo = arc; - // non-emit arc points get -1 for rendering scope.addOutput(output, point, shellMult, moveSpeed, tool); + // arc center is relative to first point arcInfo.center.move({ x: -point.x, y: -point.y, z: 0 }); last = point; continue; } else if (arcInfo) { + // accumulate and pass to last point to calc FDM E value arcDist += last.distTo2D(point); if (--arcInfo.skip === 0) { arcInfo.distance = arcDist; diff --git a/src/kiri/mode/cam/prepare.js b/src/kiri/mode/cam/prepare.js index 43a0794e..179108f8 100644 --- a/src/kiri/mode/cam/prepare.js +++ b/src/kiri/mode/cam/prepare.js @@ -866,6 +866,7 @@ export async function prepare_one(widget, settings, print, firstPoint, update) { let { arc } = point; skip = arc.skip; type = arc.clockwise ? 2 : 3; + // arc center is relative to first point center = arc.center.clone().move({ x: -point.x, y: -point.y }); xfactors.push(xfactors.shift()); } diff --git a/src/kiri/mode/fdm/export.js b/src/kiri/mode/fdm/export.js index c84fa007..0ebd97ff 100644 --- a/src/kiri/mode/fdm/export.js +++ b/src/kiri/mode/fdm/export.js @@ -120,6 +120,7 @@ export function fdm_export(print, online, ondone, ondebug) { // lenghts of each filament (by nozzle) consumed segments = []; + // build tool use list for this job let tools_used = Object.keys(tools); for (let tool of tools_used) { subst[`tool_used_${tool}`] = true; @@ -694,6 +695,7 @@ export function fdm_export(print, online, ondone, ondebug) { continue; } + // distance to last point for accumulation and emit calc dist = lastp ? lastp.distTo2D(point) : 0; // re-engage post-retraction before new extrusion @@ -705,6 +707,8 @@ export function fdm_export(print, online, ondone, ondebug) { if (isBelt) { setTempFanSpeed(out.fan); } + + // run fan speed macro when value changes if (fanSpeed !== lastFanSpeed) { appendAllSub(gcodeFan); lastFanSpeed = fanSpeed; @@ -741,10 +745,8 @@ export function fdm_export(print, online, ondone, ondebug) { if (dist && speedMMM) { time += (dist / speedMMM) * 60 * timeFactor; } - // if (isNaN(time)) { - // console.log({ layer, path, dist, speedMMM, timeFactor }); - // throw "NaN"; - // } + + // accumulate distance traveled and update macro var distance += dist; subst.progress = progress = Math.round((distance / totaldistance) * 100); @@ -773,13 +775,6 @@ export function fdm_export(print, online, ondone, ondebug) { subst.remain_time = Math.ceil(print.total_time / 60); } - function emitQrec(rec) { - let {e, x, y, dist, emitPerMM, speedMMM} = rec; - emitMM = extrudeMM(dist, emitPerMM, e); - moveTo({x:x, y:y, e:emitMM}, speedMMM); - emitted += emitMM; - } - if (inloops) { append(`M808`); }