-
Notifications
You must be signed in to change notification settings - Fork 0
Cut Lists and Layouts
Once every surface has a material and a placement pattern, the planner can compute the full material layout: every individual piece, its size, its rotation, the cut lines required to produce it, and the resulting amount of waste. The cut list and layout statistics are derived from that single source of truth.
Feature line from the README: 🪚 Auto-generated cut lists, cutting diagrams, and waste reports.
Each surface with materialId and placementPatternId produces one
MaterialLayout describing:
- The tessellation of
material.unitWidth × material.unitHeightpieces using the pattern. - The clipped polygon for each piece (so pieces around openings or surface edges carry exact cut outlines).
- A per-piece status (
full,cut,waste) and a deterministic piece code. - A settings snapshot so the layout can detect when the material, pattern or edge rules have changed.
Two entry points exist:
-
Live preview — every time the project state changes,
generateLayoutsForProjectproduces a non-optimised layout used to render the canvas and the Layouts panel. This keeps the canvas in lock-step with the project, even before optimisation is run. -
Optimised layout — pressing Generate material layout in the
editor toolbar (or Optimize all in the Layouts panel) calls
runOptimizerin a Web Worker. The worker runs the placement engine with the priorities configured per pattern and returns optimised layouts that are persisted inproject.materialLayouts.
The Layouts panel automatically distinguishes the two states — each row is
labelled Optimized HH:MM:SS or Live preview.
Located in the bottom panel of the editor:
| Column | Meaning |
|---|---|
| Surface | Surface name. |
| Material | Coloured swatch + material name. |
| Pattern | Active placement pattern. |
| Pieces | Total piece count produced by the layout. |
| Full | Number of full, uncut unit pieces. |
| Cut | Number of pieces that needed cutting. |
| Purchased | Total purchased material area required (in m² / cm² / mm² depending on size). |
| Waste | Waste percentage relative to purchased area. |
| Status | "Optimized" with a timestamp or "Live preview". |
Click Optimize all to regenerate every layout via the worker. Existing
layouts are atomically replaced through setMaterialLayoutsCommand, which
means the regeneration is undoable.
The Cut List tab in the bottom panel shows every piece grouped by:
- Cut code (
A1,A2…), with+Nsummarising additional identical codes. - Surface, material and overall size (
width × heightin mm). - Quantity, thickness, whether overlap is included, and any notes (waste, oversized, undersized…).
The cut list takes the project's blade kerf into account when listing
piece dimensions. The kerf is editable directly above the table; the
input accepts both . and , as decimal separators. Changes go through
changeProjectSettingsCommand, so the kerf is undoable just like
everything else.
For every persisted layout, the engine builds a cutting diagram that shows how to slice each purchased panel into individual pieces. The diagram drives the per-page material output in the PDF Export:
- Each purchased panel is rendered to its own page.
- Pieces are labelled with the cut code shown in the cut list.
- Joints, overlap regions and waste pieces are colour-coded for the cutter.
computeLayoutStats (used both in the panel and in the PDF) produces:
-
totalPieceCount,fullUnitCount,cutPieceCount -
coveredAreaMm2,purchasedMaterialAreaMm2,wasteAreaMm2 -
wastePercentand a per-material breakdown so the project-levelProjectStatsPanelcan list "X m² needed, Y % waste" for every material in the project.
- Live preview & optimised generation —
src/domain/materialLayout/generateLayoutsForProject.ts,optimizeMaterialLayout.ts,scoreMaterialLayout.ts - Worker plumbing —
src/workers/materialLayoutOptimizerClient.ts,materialLayoutOptimizerWorker.ts - Cut list —
src/domain/materialLayout/materialCutList.ts,src/features/materialLayout/MaterialCutListTable.tsx - Cutting diagrams —
src/domain/materialLayout/cuttingDiagram.ts - Stats —
src/domain/materialLayout/layoutStats.ts,src/features/materialLayout/ProjectStatsPanel.tsx - Layout list UI —
src/features/materialLayout/LayoutsListPanel.tsx - Canvas rendering —
src/features/materialLayout/MaterialLayoutLayer.tsx
Documentation for the material-layout-planner project. Every feature in the application is documented here — see the contribution rules before opening a pull request.