Skip to content

fix: laser arrange-view translation not reflected in gcode#494

Open
clugtu wants to merge 3 commits into
GridSpace:masterfrom
clugtu:fix/laser-translate-gcode
Open

fix: laser arrange-view translation not reflected in gcode#494
clugtu wants to merge 3 commits into
GridSpace:masterfrom
clugtu:fix/laser-translate-gcode

Conversation

@clugtu

@clugtu clugtu commented Jun 30, 2026

Copy link
Copy Markdown

Summary

  • Drag-and-drop translation in the arrange view was silently ignored during laser/drag-knife/WEDM gcode generation
  • Rotation worked correctly because it calls geometry.applyMatrix4(), baking the transform into vertex data
  • Translation only updated track.pos and mesh.position — vertices stayed at origin
  • The laser_prepare packer then auto-repositioned all tiles, discarding any manual layout

Fix

  • In laser_prepare, apply widget.track.pos offset to each widget's slice.offset polygons before emitting them to the packer (poly.move() handles inner/hole polygons recursively)
  • Detect manual positioning via hasManualPositions — if any widget has been moved from origin, skip the packer's auto-reposition step so user positions are preserved
  • Auto-layout (packer) is unchanged when no widgets have been manually moved

Test plan

  • Load a shape, drag it off-center in arrange view, generate gcode — verify cut path matches arranged position
  • Load multiple shapes without moving them — verify packer auto-layout still works as before
  • Verify rotation still works correctly in combination with translation
  • Test drag-knife (DRAG) and WEDM modes — same code path, same fix applies

🤖 Generated with Claude Code

clugtu and others added 3 commits June 26, 2026 18:54
Adds a 'send to host' panel in the laser export modal that posts gcode
directly to an OctoPrint or Moonraker endpoint. Enabled via the
exportOcto controller setting. Host and API key persist in localStorage.

Also adds tools/cncjs-bridge — a zero-dependency Node.js shim that
accepts OctoPrint-format multipart uploads from Kiri and forwards them
to CNCjs's /api/gcode endpoint, bridging the two without modifying
either tool's server.

Fixes optional chaining on navigator.serviceWorker in boot path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a fill toggle and spacing setting to laser output. When enabled,
fillOut() generates concentric inset paths inside each closed shape by
repeatedly offsetting the outer boundary inward. Inner children are
stripped before offsetting to prevent Clipper from expanding holes and
collapsing the ring prematurely; for shapes that have holes, filling
stops when the ring shrinks to the hole area so fill stays within the
material region.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Translation (drag/drop) only updated track.pos and mesh.position, leaving
geometry vertices at origin. The laser prepare packer then auto-repositioned
everything, discarding the user's manual layout.

Fix: apply track.pos offset to slice polygons before emitting to the packer,
and skip packer auto-repositioning when any widget has been manually moved.
Rotation already worked because it bakes into geometry via applyMatrix4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant