# Kerfwise Sheet Nesting Optimizer > Nest rectangular and shaped parts on sheets: kerf, grain, yield, lower bound, offcuts, SVG + DXF. A cutting optimiser for panel saws and CNC routers: list parts (rectangles, L-shapes, corner cuts or quarter rounds) with quantity and grain, choose the sheet size (e.g. 2800 × 2070), saw kerf and trim margin, and get guillotine-cuttable or MaxRects layouts, sheet count, yield per sheet, the lower bound on the sheet count and the gap to it, reusable offcuts, the guillotine cut sequence, SVG drawings and a DXF R12 file. An optional deep search tries many seeded variations and stops as soon as the layout is proven optimal. Part of usefulweb.app (https://usefulweb.app/). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://kerfwisesheetnesting.usefulweb.app/ (interactive tool at https://kerfwisesheetnesting.usefulweb.app/tool) - JSON API: POST https://kerfwisesheetnesting.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://kerfwisesheetnesting.usefulweb.app/api/v1/tool) - OpenAPI: https://kerfwisesheetnesting.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://kerfwisesheetnesting.usefulweb.app/mcp - tool `kerfwise_sheet_nesting` ## Inputs - parts (table, required): Parts - Length runs along the grain. Tick grain to forbid rotation (on a grained material). - sheetLength (number): Sheet length - Common sizes: 2800 × 2070, 2440 × 1220, 3050 × 1220, 2500 × 1250, 2620 × 2070, 2750 × 1830, 2800 × 2100, 2440 × 1830, 1220 × 610. - sheetWidth (number): Sheet width - sheetQty (integer): Sheets available - 0 = unlimited. - sheetPrice (number): Price per sheet - kerf (number): Saw kerf - trim (number): Trim margin per edge - method (select): Method - grainedMaterial (boolean): Material has grain - allowRotation (boolean): Allow rotating parts without grain - minOffcutLength (number): Min. offcut length to keep - minOffcutWidth (number): Min. offcut width to keep - effort (select): Optimisation - iterations (integer): Deep search iterations - seed (integer): Search seed - Same seed + same input = same layout. ## Method - Parts are inflated by one kerf and the usable sheet (sheet − 2 × trim) by one kerf, so neighbouring parts are exactly one kerf apart and the outer parts touch the trimmed edge. - Guillotine: free-rectangle packing with best-area-fit / best-short-side-fit and split rules (shorter-leftover-axis, longer-leftover-axis, min-area); every placement records its edge-to-edge cuts, giving a panel-saw cut sequence. MaxRects: maximal free rectangles with best-short-side, best-area or bottom-left fit (tighter, for CNC). - Each method runs a fixed set of strategies (4 sort orders × fit/split rules × rotation on/off) and keeps the best: fewest unplaced parts → fewest sheets → least sheet area → largest single offcut → guillotine preferred. Deterministic for identical input. - Grain: on a grained material, parts marked grain keep their length along the sheet length; other parts may rotate 90°. Yield = part area / full sheet area. Offcuts = non-overlapping free rectangles ≥ the minimum offcut size. - Shaped parts: nested by their bounding box in 0/90/180/270° (grained: 0/180°); the empty notches of the polygon inside the box go back into the MaxRects free list (inset by the kerf), so smaller parts fill them. Guillotine layouts cannot contain shaped parts — auto picks MaxRects then. Yield counts the true polygon area. - Lower bound = max(⌈Σ (part + kerf) area / usable area⌉, number of parts larger than half the usable sheet in both directions). Gap = sheets used − lower bound; a gap of 0 proves the sheet count optimal. Deep search: a mulberry32-seeded multi-start search (perturbed sort orders, random fit/split rules, rotation preferences) that keeps the best layout and stops early at the bound. ## Limits - Heuristic optimisation: the sheet count is proven optimal only when the gap to the lower bound is 0. Check that your saw can follow the cut sequence and measure your blade’s real kerf.