Repository navigation
Conversation
Arrange → Nesting… packs the selected parts (or every object) on a board: sheet size and position, spacing between parts, sheet margin, free or stepped rotation, optional mirroring (never for parts with text if asked) and where the offcut should stay: centred, in a corner or along a side. - src/nesting: Fabric-free core. Parts are rasterised conservatively on a fine grid (dilated by half the spacing), placed greedily, then improved with late-acceptance hill climbing over order, angle and mirror, resuming from checkpoints. Holes in ring parts receive smaller parts. - Runs in Web Workers (one seed/strategy each) with a live preview; falls back to the UI thread when workers are unavailable. - Engines plug in through NestEngine + registry; common-line cutting, scrap obstacles and quantities are reserved in the types for later. - Apply moves the objects in a single undo step; parts that do not fit are lined up next to the sheet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs Arrange → Nesting on six rectangles in the desktop app: checks the search runs in the nesting worker, every part lands inside the sheet margin with the requested spacing, and a single undo restores the layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Laser parts are usually laid out by hand on a board. With many irregular parts (petals, leaves, rings with holes…) it is slow, and the offcut left over is rarely a shape that can be reused. This is the "Nesting / auto-arrange" item of the P4 roadmap in
TODO.md.Change
New Arrange → Nesting… dialog:
Settings are remembered in
localStorage(openburn.nesting).How it works (
src/nesting/, no Fabric dependency)extract.ts) reads Fabric's own geometry (path commands, points, rect/ellipse sizes) throughcalcTransformMatrix(), so it matches what is drawn. The cut layer is the layer of the part's largest closed contour. Its inner contours are through holes, and smaller parts can be nested inside them. Closed shapes on other layers (engravings) and text are filled, so nothing lands on them.engines/grid.ts): each orientation is rasterised conservatively on a fine grid (0.2 mm minimum, at most 1200 cells per side), dilated by half the spacing, so non-overlapping masks always respect the spacing. A greedy pass places the largest parts first. A late-acceptance hill climbing then permutes the order, angles and mirroring, and resumes from checkpoints so the unchanged prefix of a layout is not placed again.frame.tsmaps that frame to the requested corner or side with flips and a transpose. These never mirror a part on their own.vite.config.tssetsworker.format: 'es'.NestEngine+registry.ts. The dialog shows an engine picker as soon as more than one engine is registered.NestOptions.commonLine,NestResult.sharedEdges), irregular scrap sheets (NestSheet.obstacles) and quantities (NestPart.quantity).docs/ARCHITECTURE.md(new §4b) andTODO.mdare updated.Testing
npm run typecheck,npm run buildand the full unit suite (506 tests) pass. New tests cover:e2e/nesting.spec.tsruns the whole flow in Electron. It checks that the search runs in the nesting worker, that the parts stay inside the margin with the requested spacing, and that one undo restores the layout. The rest of the e2e suite passes exceptnodes-snap.spec.ts › node mode deletes only the selected node, which already fails onmainhere.🤖 Generated with Claude Code