Matt b5fb86f245 fix: bound four unbounded expansions in STEP and IGES import
Each of these asks the allocator for tens of gigabytes, or runs for hours, from
a file of a few kilobytes to a few megabytes. An allocation failure is an abort,
so no panic guard can report it and the user's unsaved work is gone.

- IGES composite curves (102) name their children by pointer, and a tree whose
  every node names the same child twice fans out to 2^30 leaf visits under the
  depth cap. Count the entities visited and the segments produced against one
  budget, since a node that yields no segment trips no bound on the output, and
  refuse a composite curve that contains itself.
- IGES directory entries could all name the same parameter range, each
  materialising it as its own string and token list. Keep the total text
  proportional to the parameter section the file carries.
- STEP knot multiplicities were expanded into one value each before the knot
  count was compared with the control points: 20 million knots of multiplicity
  64 built a 10 GB vector only to be rejected. Check the sum first.
- One STEP face could list any number of boundary loops, each cloning its edge
  handles into a new wire that the face extent then samples. Cap the loops and
  the edges they hold; 100,000 bounds went from 2.1 GB to an immediate error.

Also guard the IGES translation, which was the one importer stage outside every
panic guard, keep the vertex-sewing bucket key clear of the overflow its
neighbour lookup caused for coordinates near f64's range, and count how often a
loop passes each vertex once instead of once per edge.

Fixes #146

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit c32792b71c76d74348ad5002d8d2da870937e58e)
2026-10-11 08:22:07 -07:00
2026-10-11 16:07:46 +08:00
2026-10-11 16:07:46 +08:00

SolveCraft

Parametric 3D CAD; an open-source, clean-room reimplementation of Autodesk Fusion 360, built in pure Rust.

Sketch, constrain, and build solids with a parametric feature timeline. Change a dimension and watch your model rebuild. Run it on your desktop, in your browser, or let AI agents model through the built-in MCP server. Part of the storytold "craft" family.

An AI agent builds a parametric enclosure in SolveCraft over MCP, then the width is changed in the Parameters dialog and the model rebuilds (3x speed)

An agent builds an electronics enclosure over MCP: sketches on faces, shell, a port cut, one screw boss patterned to four, then width 80 → 100 mm in the Parameters dialog and the timeline rebuilds. 3× speed; full video, script in examples/demo.

Documentation: the SolveCraft book (user guide, developer guide and command reference; sources in docs/book), and the web app to try it in the browser.

Status: early but usable for simple parts. 76 of 76 reference parts built in Fusion rebuild in SolveCraft with the same volume, area and topology (docs/oracle.md); command parity with Fusion's Design workspace is tracked in docs/parity.md. Open work and known bugs are in GitHub issues, and help is welcome: see CONTRIBUTING.md.

What works

  • Sketches on origin planes, offset planes or planar faces: lines, rectangles, circles, arcs, polygons, slots, ellipses, fit/control splines, conics and text; construction geometry, projection, trimming, fillets and chamfers, including corners at the origin. New face attachments retain supported construction identities and chosen occurrences; missing sources expose an explicit plane repair workflow. See face attachments. Explicitly closed fit splines and closed associative offsets use periodic C2 interpolation. Supported convex line-and-arc offsets retain their identity when an inset consumes corner arcs, and linked extrusions follow the current boundary. Breaking the association freezes the boundary and keeps existing extrusions usable. Curve drawing and picking adapt together to zoom and display scale, including small circles at Fit and sketches in placed components.
  • Constraints and dimensions solved by our own solver (damped Gauss–Newton with degree-of-freedom analysis): coincident, horizontal/vertical, parallel, perpendicular, tangent, equal, concentric, collinear, midpoint, symmetry, fix; linear, aligned, horizontal, vertical, radius, diameter and angle dimensions driven by parameters. Over-constraining edits are rejected; fully constrained geometry turns black.
  • Profiles found automatically, including regions split by lines and holes inside outlines. Newly captured complete adaptive boundaries retain their outer and hole source identities when spline span counts change. Partial or ambiguous boundaries do not qualify.
  • Features on a parametric timeline: extrude, revolve, sweep, loft, fillet/chamfer, shell, draft, holes, threads, patterns, mirror, split, combine, move and construction geometry. The timeline rebuilds incrementally; features can be edited, suppressed, renamed, reordered and deleted. Supported geometry and current limitations are described in ROADMAP.md. New revolves preserve symmetric and two-sided angular placement across reversed axes; older designs retain their saved convention when reopened or edited.
  • Parameters and configurations with unit-aware expressions (2 * width + 5 mm, angle / 2), ordered rules, feature suppression and per-row body materials/appearances.
  • Assemblies with nested components and occurrences, joints, motion studies, contact sets, interference and material-aware mass properties. Recorded body transfers preserve modelling history and world placement; 3D sketch wires retain their coordinate frames through edits.
  • Sheet metal with flanges, hems, fold/unfold/refold, material cutouts, flat patterns, retained shallow prismatic pockets, exact line/arc/circle DXF outlines and bend tables; plastic enclosure features and rules. Pocket depth and side survive unfold/refold and appear separately from through-hole outlines in the flat preview and DXF.
  • Files: designs as JSON (.solvecraft), export to STEP (AP242 with body names, colours and components as assemblies; revolved faces as native planes, cylinders, cones, spheres and tori), IGES 5.3 (manifold solid B-reps with names and colours), 3MF, STL (binary/ASCII) and OBJ; 3MF, STL and OBJ import as mesh bodies (they render, measure, move and export; solid features need B-rep bodies); STEP import (AP203/AP214/AP242 solids, assemblies, units, names, colours) and IGES import (manifold solid B-reps, or trimmed and bounded surfaces sewn into solids) as a base feature that later features build on — open a .step/.stp/.igs/.iges file, insert one into a design, or drop it on the window (docs/step-import.md).
  • Desktop app (egui + wgpu): toolbar with workspace tabs, browser, timeline, 3D viewport with axis view and navigation bar, sketch tools, feature dialogs, command palette, and a JSON-lines control channel so agents and tests can drive it.
  • Headless CLI solvecraft-cli: run command scripts, measure (volume, area, centre of mass, face/edge/vertex counts), export, render PNG snapshots, replay Fusion oracle recipes.
  • MCP server solvecraft-cli mcp: AI agents model, measure and look at parts headless or in the running app (see below).

Build and run

cargo run --release -p solvecraft -- --sample          # desktop app with a sample part
cargo run --release -p solvecraft-cli -- commands      # the command registry
cargo run --release -p solvecraft-cli -- run examples/bracket.json --out bracket.step
cargo run --release -p solvecraft-cli -- snapshot examples/bracket.json --out bracket.png
cargo run --release -p solvecraft -- part.step          # open a STEP file as a new design
cargo run --release -p solvecraft-cli -- eval part.step # measure an imported STEP file
cargo xtask ci                                          # fmt, clippy, tests, assets, layers, wasm

Windows builds: cargo xwin build --release --target x86_64-pc-windows-msvc -p solvecraft.

In the browser: cd apps/solvecraft-web && trunk build --release --public-url ./ (WebGPU, or WebGL2 with ?webgl; ?sample opens the sample part).

Scripts

A script is a JSON list of commands, the same ones the UI runs:

{"commands": [
  {"command": "sketch.create", "params": {"plane": "XY"}},
  {"command": "sketch.rectangle.two_point", "params": {"p0": [0, 0], "p1": [40, 30]}},
  {"command": "solid.extrude", "params": {"distance": 20}},
  {"command": "solid.fillet", "params": {"edges": [[0, 0, 10]], "radius": 3}}
]}

AI agents (MCP)

solvecraft-cli mcp is a Model Context Protocol server on stdio. Headless it runs its own design session; with --connect 127.0.0.1:PORT it drives the app started with solvecraft --control PORT, so you can watch the agent model. Tools: list_commands, execute, batch, inspect_design, measure, body_topology, set_parameter, screenshot (returns the image), export, undo, redo, new_design, open, save. Claude Code: claude mcp add solvecraft -- solvecraft-cli mcp. Details, client configuration and an example session: docs/mcp.md.

Architecture

Layer Crates Role
L0 geom vectors, planes, profiles, meshes and their measures
L1 sketch, kernel, render constraint solver and profiles; the B-rep kernel boundary (truck); view math and CPU rasterizer
L2 doc parameters, expressions, the feature timeline and its incremental evaluation
L3 io design files, STL/OBJ/STEP/3MF export, STEP and 3MF/STL import features
L4 engine the session and the command registry (everything is a command)
L5 ui-egui, mcp the swappable desktop front end; the MCP server (headless or bridged to the app)
apps solvecraft, solvecraft-cli desktop app, headless CLI

Contributing

See CONTRIBUTING.md: how to build and test, the code map, the clean-room and licence rules, and where help is wanted most.

Licence

MIT OR Apache-2.0, at your option. SolveCraft is not affiliated with Autodesk; Fusion is a trademark of Autodesk, Inc.

S
Description
Tier 1: clean mirror of github.com/tangency-labs/solidcraft (SolidCraft, parametric 3D CAD in pure Rust, MIT OR Apache-2.0). Upstream remote = original GitHub repo for sync. NO REBRAND HAPPENS HERE. Working fork: OneCAD.
solidcraft.io Readme
151 MiB
0 Stars 1 Watchers 1 Forks
Languages
Rust 97.2%
Python 1.7%
JavaScript 0.5%
Shell 0.3%
PowerShell 0.1%
Other 0.1%