Slice 3b task 2 (D8/C10-C12). New OpenNest.Engine.Jobs.ClampRemovalRecovery: after the ordinary clamped solve leaves demand unmet, probes (via the caller's own selected engine, quantity one, one fresh empty sheet) whether each unplaced part fits on any offered stock with every clamp in place; only a part that fits nowhere is 'blocked' (C10). For a blocked part, searches ascending run size then ascending start index over each stock's own clamp zones (already rail-position order) for the smallest contiguous run whose removal lets it fit alone - fewest clamps first, nearest the origin on ties (C11). Builds reduced-clamp stock variants for every resolved (part, stock), re-solves the whole residual demand (so freed space can also take other unmet parts, C12) with original stock carried forward minus phase 1's usage (a finite pool is never offered both full and reduced, so it is never double counted) and merges the result back: phase 2 placements get fresh instance indices continuing from phase 1's, plates are reindexed, and fulfillment/stock usage are recomputed. Returns null (no-op) whenever the job is already complete, no stock has any clamp, no remaining part is genuinely blocked, or even every clamp removed cannot fit a blocked part - so an ordinary job is bit-identical to Slice 3 (C10's last sentence). NestPipeline.RunCore calls it once, right after the main solve, only on the non-cutout-preview path; a recovery replaces 'raw' and expands 'job' (adding exactly the reduced-clamp variants used) before the existing validation/cost/grouping/binding code runs unchanged. NestPipelineCommit.SyncClampZones now derives which rail clamps (if any) are missing from a committed sheet's solved zones and, when the rail recreates exactly that reduced set, reattaches the rail with Plate.SetClampRail(rail, removedClamps) - so a recovered sheet keeps following the rail, minus its removal, through later resizes (C13), using Slice 3b task 1's plumbing. Tests: 7 new (OpenNest.Engine.Tests/Jobs/ClampRemovalRecoveryTests.cs, ClampRemovalCommitTests.cs) covering the minimal-removal + nearest- origin tie-break, freed space taking other residual demand (C12), a no-op on an already-complete job, no-op with no clamps offered, a part blocked only by stock exhaustion never being treated as clamp- blocked, a part unfit even clamp-free staying unplaced, and the full Auto-Nest-to-commit path keeping Plate.RemovedClamps/ClampRail/ ClampRemovalMinutes correct through a resize. Mutation checks (disabling the FitsAnywhere gate; reversing the ascending-start tie- break) turn the relevant assertions red, confirming real coverage. Gates: Release OpenNest.Tests 3884 passed/31 skipped, OpenNest.IO.Tests 105 passed, OpenNest.Engine.Tests 878 passed/2 skipped; desktop cross-build (-p:EnableWindowsTargeting=true) clean; scoped dotnet format --verify-no-changes clean. Desktop surface (removed-clamp display, Auto Nest summary, cut-time minutes, Clamps dialog removal-minutes field) is Slice 3b task 3, not yet done.
OpenNest
A Windows desktop application for CNC nesting — imports DXF drawings, arranges parts on material plates, and exports layouts as DXF or G-code for cutting.
Features
- Import / export — DXF & DWG parts (ACadSharp), Excel BOMs, bend-line detection, built-in parametric shapes; export DXF or post-processed G-code.
- Nesting — automatic multi-plate/multi-material jobs, interlocking pair evaluation, and built-in or plug-in engines. Choose an engine.
- Plate operations — manual sheet cut-offs, plate- or nest-wide automatic scrap cutoffs with a minimum tail-to-keep setting, oversized-part splitting (straight, weld-gap tabs, spike-groove), interactive editing, and spacing-aware pushes that can slide along or away from touching parts.
- Visual overlap check — highlight shared material on the active plate, rechecked automatically after edits, including containment and cutouts, with area shading, pair centroids, and hover details through View > Overlap Check. Usage and limitations.
- CNC output — configurable lead-ins/outs and tabs, contour editing, user-defined G-code variables (
$name→#200+machine variables), plugin post-processors (Cincinnati CL-707/800/900/940/CLX included). Pre-post verification checks overlaps, missing lead-ins, and rapid crossings, with explicit risk acknowledgment required to bypass warnings.
Requirements
- Windows 10+ for the desktop app; the console, API, and most test projects build on Linux/macOS too.
- .NET 8 SDK to build from source.
Windows release ZIPs are self-contained: extract the entire archive into a new folder and run OpenNest.exe; no separate .NET installation is needed. The Rectangles and Irregular nesting engines are built in; see nesting engines. Use the ZIP and SHA-256 checksum from GitHub Releases, not the source-code archives.
Build, Test, Run
git clone https://github.com/ajisaacs/OpenNest.git
cd OpenNest
dotnet build OpenNest.sln # full solution (Windows)
dotnet test OpenNest.Engine.Tests/OpenNest.Engine.Tests.csproj # cross-platform engine tests
dotnet test OpenNest.Tests/OpenNest.Tests.csproj # core/engine/IO/API tests
dotnet test OpenNest.FrontEnd.Tests/OpenNest.FrontEnd.Tests.csproj # console/MCP/API integration
dotnet run --project OpenNest/OpenNest.csproj # desktop app (Windows)
OpenNest.WinForms.Tests (desktop-assembly tests) runs on Windows only; CI runs it and OpenNest.FrontEnd.Tests on a GitHub-hosted Windows runner for every master push and pull request.
Quick start
- File > New Nest
- Import DXFs via the CAD Converter (layer/color filtering, bend detection, G-code preview) or create built-in shapes
- Define plate size, material, quadrant, spacing
- Fill — the engine arranges parts
- Optionally add cut-off lines, apply Part Sequencing to order crossing cut-offs before their parts, then save
.nest, export DXF, or post-process to G-code
Review part spacing before cutting, especially for interlocking pairs. See pair-spacing checks and current limitations.
Command-Line Interface
dotnet run --project OpenNest.Console -- part.dxf --size 60x120 # fill one plate
dotnet run --project OpenNest.Console -- part1.dxf part2.dxf --size 60x120 --autonest
dotnet run --project OpenNest.Console -- project.zip # re-fill a nest file
| Option | What it does |
|---|---|
--size WxL |
Set the plate size; required for DXF-only input. |
--autonest |
Run validated whole-job nesting on one sheet. |
--engine <name> |
Choose a whole-job engine with --autonest, or a fill strategy without it. |
--quantity <n> |
Limit parts placed (0 means unlimited). |
--spacing <value> |
Override part spacing. |
--template <path> |
Read plate defaults from a nest file. |
--output <path> |
Set the output nest path. |
--check-overlaps |
Check the result for overlaps. |
--post <name> |
Run a post-processor after nesting. |
--no-save |
Skip saving the nest. |
--allow-invalid |
Explicitly keep a representable invalid --autonest result; otherwise it is rejected. |
Run dotnet run --project OpenNest.Console -- --help for the complete options and their defaults.
Project Structure
| Project | Purpose |
|---|---|
| OpenNest | WinForms desktop app |
| OpenNest.Core | Domain model, geometry, CNC primitives; material-overlap diagnostics |
| OpenNest.Engine | Nesting algorithms and whole-job contracts |
| OpenNest.IO | DXF/DWG, .nest, G-code, BOM I/O; CAD import |
| OpenNest.Console | Headless batch nesting |
| OpenNest.Api / .Data | Programmatic pipeline; machine & cutting-parameter data |
| OpenNest.Gpu | GPU-accelerated pair evaluation (ILGPU) |
| OpenNest.Benchmark | Head-to-head engine comparison |
| OpenNest.Mcp | MCP server for AI tool integration |
| Posts/ | Post-processor plugins (Cincinnati CL / CI Fiber lasers, Gravograph IS8000) |
| *.Tests | Cross-platform suites; WinForms tests are Windows-only |
Nesting Engines
Default compares the built-in Irregular and Rectangles engines and keeps the best valid whole-job layout. Other engines and plug-ins suit particular jobs; see which engine to use. Desktop Auto Nest, console autonest, MCP autonest, and the API share an independent validation pipeline, including for plug-ins. Automatic nesting and validation explains how callers handle invalid results.
File Format
.nest files are ZIP archives containing drawing programs, metadata, plates, and placements. Saved nests retain each part's lead-ins, lead-outs, tab gaps, and locks, plus the plate's cutting settings. Changing a drawing's geometry removes obsolete cutting paths from its parts; name, quantity, and color edits preserve them. See the file-format reference for compatibility and recovery behavior.
Supported Formats
| Format | Import | Export |
|---|---|---|
| DXF | Yes | Yes |
| DWG | Yes | No |
| Excel BOM | Yes | No |
| G-code | No | Yes (post-processors) |
.nest |
Yes | Yes |
Keyboard Shortcuts
Ctrl+F fill area · F zoom to fit · Shift+wheel / middle-click rotate · X/Y push · arrows nudge · Shift+arrow push.
Status & License
Actively developed; core workflows run end-to-end from DXF import to G-code. Contributions welcome. MIT licensed — see LICENSE.

