SurfaceCraft
Health Warn
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
SurfaceCraft: open-source, clean-room scan-to-CAD in pure Rust. Mesh to aligned primitives, NURBS surfaces and a parametric feature tree, exported to STEP/IGES. Desktop, web (wasm), CLI and MCP.
SurfaceCraft
Scan to CAD: an open-source, clean-room reverse-engineering application, built in pure Rust.
Turn a raw scanner mesh into clean, editable CAD: align it, extract primitives, fit freeform
NURBS surfaces and rebuild a parametric feature tree, then export STEP or IGES.
Runs natively on Windows, macOS and Linux, and in the browser via WebAssembly.
Why SurfaceCraft · The pipeline · Quick start · For agents · Measured accuracy · Architecture · Roadmap · License and credits
Why SurfaceCraft
- The whole workflow in one place. Mesh import and cleanup, alignment, region segmentation,
primitive and freeform fitting, sketches with a constraint solver, solid features and CAD
export. No round trips between a mesh tool and a CAD package. - A real B-rep kernel. Surfaces and solids are built and evaluated by the open
solidcore kernel, so what you export is a valid
STEP/IGES body, not a triangle soup in disguise. - Measured, not promised. Every accuracy claim below comes from a test with a fixed threshold.
Thresholds are never loosened to make a test pass. - Agent-native. Every action is a command (
area.verb) with JSON Schema input and output.
The desktop UI, the CLI, scripts, the MCP server and the built-in AI assistant all drive the
same registry, so anything you can click, an agent can do. - Never crashes on bad input. Files, JSON and MCP parameters are treated as hostile: no
unwrap,panicorunsafein application code, with fuzz tests on every importer and every
command. - Everywhere, and yours. One Rust codebase for desktop and the web. No subscription, no
licence server, no telemetry.
The pipeline
| Stage | What you get |
|---|---|
| Import and clean | STL, OBJ and PLY; hole filling, spike and debris removal, QEM decimation, Taubin smoothing, noise estimation. |
| Align | 3-2-1 datums, N-point (Kabsch), point-to-plane ICP, alignment to world axes. |
| Segment and fit primitives | Automatic region segmentation; plane, cylinder, cone, sphere and torus fits with automatic type detection; symmetry planes; persistent, editable regions. |
| Freeform surfaces | Fit Surface (one NURBS patch per region) and AutoSurface (quad layout to a continuous patch network), snap, crease, merge, thicken to a solid. |
| Parametric modelling | 2-D sketches with a constraint solver (fully/over-defined detection), sections from the mesh, extrude, revolve, fillet, chamfer, shell, pattern, trim, cut and booleans in a history DAG with undo, redo and suppress. Radius suggestions read from the scan. |
| Check and export | Colour deviation maps against the scan; STEP (surfaces and solids) and IGES. |
Quick start
cargo run --release -p surfacecraft # desktop app (egui + wgpu)
cargo run --release -p surfacecraft-cli -- run examples/scripts/m0-smoke.json # run a command script headless
cargo run --release -p surfacecraft-cli -- commands # list every command
cargo run --release -p surfacecraft-cli -- describe mesh.import # its input and output schema
cargo xtask ci # fmt, assets, licences, layers, clippy, wasm, tests
The examples/scripts folder walks the whole pipeline, one script per stage:
alignment, primitives, Fit Surface, AutoSurface and parametric modelling.
Web
cargo xtask web # → apps/surfacecraft-web/dist (serve it with any static server)
You need wasm-bindgen on your PATH (the version of Cargo.lock) and the nightly toolchain the
threaded bundle is built with: rustup toolchain install "$(cargo xtask web-toolchain)" --profile minimal --component rust-src. dist holds two bundles and a page that picks one: mt/ with
threads (heavy tools run in web workers), which the browser allows only on a cross-origin isolated
page, so serve dist with the headers Cross-Origin-Opener-Policy: same-origin andCross-Origin-Embedder-Policy: require-corp (the vercel.json in dist sets them on Vercel); andst/ without threads, used wherever the page cannot share memory (no headers, an older browser,?threads=0). cargo xtask web --no-threads builds only st/, on stable. The browser build renders
with WebGPU, falling back to WebGL.
For agents: MCP, CLI and scripts
cargo run --release -p surfacecraft-cli -- mcp # MCP over stdio
cargo run --release -p surfacecraft-cli -- exec region.auto_segment '{…}' # one command, JSON in, JSON out
cargo run --release -p surfacecraft-cli -- assist align "put the part on the world axes"
- MCP server. Scan to STEP in three calls:
mesh_import,scan_to_solid,export_step.scan_to_solidcleans the scan, builds the solid (primitives for prismatic parts, a patch
network for organic parts, castings and body panels) and measures it against the scan; it
answers with a verdict (pass,review,fail), the deviation and the next steps to take.
Every registry command is callable as a tool. The default listing is compact (42 KB: one tool
per command area plus the workflow commands);--tools fulllists one tool per command.
There are general tools to list and describe commands, run batches (rolled back on the first
failure), undo and redo, inspect the design and take viewport screenshots. When the desktop
app is running, the server bridges to it, so an agent works in the same session you are
looking at; otherwise it runs headless (--local, files only with--allow-files).
Add it to an MCP client as the commandsurfacecraft-cli mcp --allow-files. - Scripts. A script is a list of commands:
{"commands": [{"command": "mesh.import", "params": {"path": "scan.stl"}}, …]}.
Programmatic calls never open dialogs. - AI assistant. Built in, with
alignandworkflowmodes. Every step it takes is a normal
command, so it shows up in history and can be undone.
Measured, not promised
A few of the accuracy gates that run in CI (full table in docs/STATUS.md):
| Gate | Result |
|---|---|
| ICP, scan with σ = 0.02 mm noise | RMS 0.015 mm; 4° rotation recovered as 3.996° |
| Primitive fits, σ = 0.05 mm (plane, sphere, cylinder, cone, torus) | RMS 0.050 mm each (threshold 0.1) |
| Automatic primitive type, 5 kinds at σ = 0.05 mm | 5 / 5 correct |
| AutoSurface on a wave, σ = 0.02 mm | max deviation 0.089 mm (threshold 0.2); normal jump across patches ≤ 8e-5 rad |
| Sketch solver | DOF 0 and dimensions within 1e-9; redundant and conflicting constraints detected |
| STEP solid round-trip | volume and face count identical |
| Hostile input (random bytes into every importer, 20 bad values into every command) | 0 panics |
Architecture
geom ─┬─ kernel (solidcore) ─┐
├─ fit │
├─ align ├─ deviation, doc ── io ── engine ─┬─ ui-egui ─┬─ surfacecraft (desktop)
└─ sketch ─────────────┘ ├─ mcp ──────┼─ surfacecraft-cli (CLI, MCP)
└─ ai ───────┴─ surfacecraft-web (wasm)
- Layering is enforced (
cargo xtask layers): onlycrates/kerneltalks to solidcore, and
only the UI layer pulls in UI crates. - Mesh computation lives here; B-rep and NURBS go through solidcore. App-side geometry beyond
that is listed inxtask/app-geometry.txt, and the list may only shrink. - Everything is a command with a JSON Schema, so the four front ends stay thin.
- Design document:
docs/superpowers/specs/.
Roadmap
The MVP (milestones M0–M6: skeleton, alignment, primitives, Fit Surface, freeform, parametric,
web + MCP + AI) is complete. The next stages make it production-ready:
- P1 — real scans ✅ mesh editing, robust segmentation and noise estimation, a scan corpus.
- P2 — performance: parallel computation and level of detail for million-triangle scans.
- P3 and beyond: see
ROADMAP.mdand the
production-readiness plan.
Current state, measurements and known debt: docs/STATUS.md.
Contributing
Read CONTRIBUTING.md and, if you work with an AI agent, AGENTS.md
and the skills in skills/. Run cargo xtask ci before every commit.
License and credits
Licensed under either of MIT or Apache-2.0, at your option.
SurfaceCraft is an independent, clean-room implementation. It contains no code, icons, text,
layouts or data from any commercial reverse-engineering product, and depends on no GPL, LGPL or
AGPL code (cargo xtask licences --check). Third-party code and assets are credited inATTRIBUTION.md, NOTICE andTHIRD-PARTY-LICENSES.txt; see also DISCLAIMER.md.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found