fix fdm arc center output

This commit is contained in:
Stewart Allen 2026-01-01 22:27:57 -05:00
commit 36a634e805
2 changed files with 13 additions and 14 deletions

View file

@ -213,14 +213,13 @@ class Print {
if (arc) { if (arc) {
arcInfo = arc; arcInfo = arc;
// non-emit arc points get -1 for rendering // non-emit arc points get -1 for rendering
scope.addOutput(output, point, -1, moveSpeed, tool); scope.addOutput(output, point, shellMult, moveSpeed, tool);
arcDist += last.distTo2D(point); arcInfo.center.move({ x: -point.x, y: -point.y, z: 0 });
last = point; last = point;
continue; continue;
} else if (arcInfo) { } else if (arcInfo) {
arcDist += last.distTo2D(point); arcDist += last.distTo2D(point);
if (arcInfo.skip-- === 0) { if (--arcInfo.skip === 0) {
// last point of arc is arcTo?
arcInfo.distance = arcDist; arcInfo.distance = arcDist;
scope.addOutput(output, point, shellMult, moveSpeed, tool, arcInfo); scope.addOutput(output, point, shellMult, moveSpeed, tool, arcInfo);
arcInfo = undefined; arcInfo = undefined;

View file

@ -26,6 +26,7 @@ export function fdm_export(print, online, ondone, ondebug) {
{ extrudeAbs } = device, { extrudeAbs } = device,
{ exportThumb } = controller, { exportThumb } = controller,
{ extrudeMM, extrudePerMM } = FDM, { extrudeMM, extrudePerMM } = FDM,
{ outputInvertX, outputInvertY } = process,
timeFactor = (device.gcodeTime || 1) * 1.5, timeFactor = (device.gcodeTime || 1) * 1.5,
decimals = config.gcode_decimals || 4, decimals = config.gcode_decimals || 4,
zMoveMax = device.deviceZMax || 0, zMoveMax = device.deviceZMax || 0,
@ -471,8 +472,8 @@ export function fdm_export(print, online, ondone, ondebug) {
if (emit.z) o.append(axis.Z).append(epos.z.toFixed(decimals)); if (emit.z) o.append(axis.Z).append(epos.z.toFixed(decimals));
if (arc) { if (arc) {
let { x, y } = arc.center; let { x, y } = arc.center;
o.push(' I', (x + offset.x - pos.x).toFixed(decimals)); o.push(' I', x.toFixed(decimals));
o.push(' J', (y + offset.y - pos.y).toFixed(decimals)); o.push(' J', y.toFixed(decimals));
} }
if (debug) { if (debug) {
if (emit.x) minz.x = Math.min(minz.x, epos.x); if (emit.x) minz.x = Math.min(minz.x, epos.x);
@ -668,20 +669,19 @@ export function fdm_export(print, online, ondone, ondebug) {
continue; continue;
} }
let x = point.x + offset_x, // translate point to workspace coordinates
y = point.y + offset_y, let x = point.x + offset_x + offset.x,
y = point.y + offset_y + offset.y,
z = point.z; z = point.z;
// adjust for inversions and origin offsets // adjust for inversions and origin offsets
if (process.outputInvertX) x = -x; if (outputInvertX) x = -x;
if (process.outputInvertY) y = -y; if (outputInvertY) y = -y;
if (offset) {
x += offset.x;
y += offset.y;
}
// G2,G3 arcs // G2,G3 arcs
if (center) { if (center) {
if (outputInvertX) center.x = -center.x;
if (outputInvertY) center.y = -center.y;
emitMM = extrudeMM(out.distance, emitPerMM, emit); emitMM = extrudeMM(out.distance, emitPerMM, emit);
moveTo({ x, y, e: emitMM }, speedMMM, 'arc', { moveTo({ x, y, e: emitMM }, speedMMM, 'arc', {
clockwise: out.clockwise, clockwise: out.clockwise,