Inspiration

A workshop can have enough total lumber and still fail a cut list. Cutting order matters, and the blade consumes material on every cut. Offcut focuses on a practical question: what can be cut from the compatible stock already on hand, and what will remain afterward?

What it does

Offcut is a one-dimensional cutting planner for lumber and craft strips. Enter stock lengths and quantities, finished-piece lengths and counts, and saw kerf in millimeters. It produces labeled cutting diagrams, a written piece list for each stock length, explicit unplaced pieces, and an inventory of offcuts and untouched stock.

An input-order next-fit baseline makes the comparison transparent. Finished material, blade loss, and offcuts are shown separately. Offcuts may be reusable; they are not automatically treated as discarded waste. Savings are shown only when both plans fulfill the entire request.

How it was built

The interface uses React and TypeScript, with Vite for development and production builds. Calculations run in the browser without an AI service, account, API key, analytics, or paid runtime dependency. Entries live in tab memory, and the current plan can be exported as JSON or printed as a cut sheet. JSON import is not implemented.

The deterministic solver works in integer thousandths of a millimeter. It tries best-fit placement with descending, input-order, and ascending piece orders, opening new stock shortest-first and longest-first. It also considers the baseline. Candidates prioritize completed pieces, fulfilled length, opened stock, board count, and kerf loss, with stable tie-breaking.

Each extracted piece consumes a full kerf unless the final piece itself reaches the original stock end exactly. A positive tail narrower than a full kerf cannot be removed. A full final kerf may consume the entire remaining tail. No end-trimming allowance is included.

This is a heuristic. Global optimality is not proven, and a heuristic packing shortage does not prove that every possible arrangement fails.

Challenges

The difficult cases were exact-end cuts, tails narrower than the blade, decimal accounting, and incomplete requests. The planner must never overfill a stock length or silently lose a requested occurrence. It also needs to distinguish a piece that cannot fit any supplied stock length from a piece the heuristic did not place.

The interface marks previous results stale after an edit and disables print and export until replanning. Independent review also led to fixes for large totals on mobile, piece labels after Z, and untouched-stock inventory in print.

Accomplishments

The verified workshop fixture starts with four 2400 mm stock lengths and requests three 1400 mm rails and three 990 mm rails at 3 mm kerf. Offcut places all six pieces on three lengths, with 18 mm of blade loss, 12 mm of offcuts, and one untouched 2400 mm length. The disclosed baseline opens four lengths.

Changing kerf to 6 mm creates a real shortage: one 990 mm piece remains unplaced, and the savings comparison is withheld. A 2500 mm piece is explicitly reported as unable to fit 2400 mm stock.

Twelve solver test groups passed, including independent small exhaustive-oracle fixtures, 80 seeded cases, conservation, no overfill, unique occurrence accounting, precision, determinism, and capacity limits. Browser checks exercised actual editing, validation, shortages, JSON downloads, mobile layouts, reduced motion, and print styling. The public GitHub Pages build passed CI, and live checks verified its exact source commit and real outputs.

What was learned

A useful planner must explain every piece and every missing piece. Clear accounting and visible leftovers matter as much as a compact arrangement. Small independent oracle cases were useful for catching a mixed-stock choice weakness while keeping the heuristic's limits explicit.

What's next

Possible future work includes JSON import and allowances for end trimming or defects. These features are not implemented. The current project stays focused on compatible straight stock, readable cut sheets, and honest results.

AI assistance and third-party credits

OpenAI Codex assisted project planning, interface design, implementation, testing, documentation, browser verification, and independent local review under the user's direction. Generated work is disclosed as assistance; the runtime itself does not call an AI model.

React and React DOM provide the interface (MIT). Vite provides local development and bundling (MIT). TypeScript provides static checking (Apache-2.0), Playwright provides development-only browser checks (Apache-2.0), Node.js provides the local runtime and built-in test runner, and GitHub Pages hosts the static demo. Dependency versions are pinned in the lockfile, with source and hosted runtime license notices. Fonts are local system fonts; SVG marks and diagrams are implemented in the repository.

Current limitations

Use stock with matching material and cross-section. Offcut does not model grain, defects, angles, clamp clearance, end trimming, two-dimensional nesting, or costs. All dimensions are millimeters with up to three decimal places. Print CSS was checked; physical-printer and PDF pagination were not verified.

Share this project:

Updates

Submission history