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. Planned piece length, kerf, offcuts, and untouched whole stock are shown separately. The comparison measures stock allocation reduction, not observed discarded waste, avoided purchases, or carbon savings. Solid remainder includes offcuts plus untouched stock. Allocation reduction is shown only when both arrangements 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, allocated stock length, 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 allocated lengths, with 18 mm of planned kerf, 12 mm of offcuts, and one untouched 2400 mm length. The disclosed baseline allocates four lengths. Both arrangements have 18 mm kerf and 2412 mm solid remainder across the same supplied inventory. Preserving one whole board is an allocation result, not measured environmental impact.

Changing kerf to 6 mm leaves one 990 mm piece unplaced, and the allocation comparison is unavailable. A 2500 mm piece is explicitly reported as unable to fit 2400 mm stock. Interleaving the same six requested lengths gives zero allocation reduction, showing the baseline’s dependence on input order.

Nineteen solver test groups passed, including independent small exhaustive-oracle fixtures, 80 seeded cases, conservation, no overfill, unique occurrence accounting, precision, determinism, and capacity limits. Of these, seven metric regression groups cover full-inventory remainder, no improvement, shortages, whole-board zero-cut allocation, and decimal precision. Browser checks exercised actual editing, validation, shortages, version 2 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.

The existing demo and screenshots retain the original interface labels. The updated live app and source clarify allocation versus full-inventory remainder; the cutting outputs and kerf convention are unchanged.

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