``` Show HN: SolidCraft – 用 Rust 编写的开源参数化 CAD(支持 MCP) ```
Show HN: SolidCraft – Open-Source Parametric CAD in Rust (With MCP Support)

原始链接: https://github.com/bherbruck/solidcraft

``` # SolidCraft — 概述 SolidCraft是一款使用纯Rust语言编写的开源参数化三维CAD应用程序。它提供熟悉的参数化工作流程——带约束的草图、实体特征、可编辑的时间轴、参数和装配体——修改任一尺寸即可重建整个模型。 **平台:** Windows、macOS、Linux(包括ARM64架构)以及浏览器(WebGPU/WebGL2),提供安装程序、AppImage、.deb、.rpm、Flatpak和Snap软件包。 **核心能力:** 使用自定义约束求解器进行草图绘制;在参数化时间轴上提供拉伸、旋转、扫掠、放样、倒圆角、抽壳、阵列和镜像等特征;支持单位的参数和配置;支持关节和运动研究的装配体;支持钣金件、展开图和DXF导出;支持STEP/IGES/3MF/STL/OBJ格式的导入和导出;以及网格到参数化模型的转换。 **界面:** 桌面应用程序(egui + wgpu)、用于脚本编写、测量和渲染的无界面命令行工具,以及MCP服务器——允许AI代理进行建模、测量和截图(可无界面运行或与正在运行的应用程序桥接)。支持3Dconnexion鼠标。 **状态:** 处于早期阶段但已可用于简单零件;76个参考零件中有75个符合解析测量结果。采用MIT或Apache-2.0许可证,遵循净室规则开发,且独立于Autodesk。 ```

Hacker News 的一个讨论帖讨论了 SolidCraft,一个用 Rust 编写、支持 MCP 的开源参数化 CAD 工具。评论者指出,它可能使用 Truck 内核,或 NVIDIA 开源 SMLib 的 Rust 移植版。Aetheris 的开发者主张,他的解析 B-rep 内核能在编译时拒绝退化几何,避免狭长面片,并支持 STEP 导入/导出,但承认 WASM 编译时间很慢。其他人争论 AI 生成的 CAD 代码是否真由开发者编写,而一些人则为其领域专业知识辩护。SolveSpace 的维护者报告称,AI 帮助修复了 NURBS 布尔问题,并移植 GTK4。用户将 SolidCraft 与 FreeCAD 和 SolveSpace 相比,评价更好,称赞其浏览器内使用和类似 Fusion 的界面。3D 打印通过 STL/STEP/3MF 导出得到支持,而非切片。主要担忧:CAD 内核成熟度、圆角/布尔运算稳健性、拓扑命名以及长期维护。总体而言:前景可期但仍处早期,人们对 AI 辅助的开源 CAD 感到兴奋,也对困难的几何问题持怀疑态度。
相关文章

原文

An open-source parametric 3D CAD application 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.

SolidCraft 0.6: model a Raspberry Pi 4 case from an empty design: a sketch dimensioned with parameters, extrude, fillets and shell, standoffs patterned on the board's mounting holes, port cut-outs, vent slots, a colour and a height change in Parameters

A Raspberry Pi 4 case from an empty design: a sketch dimensioned with the board's parameters, extrude, fillet, shell, an M2.5 standoff patterned on the 58 × 49 mm hole rectangle, port cut-outs, vent slots and a colour, then height 24 → 32 mm in Parameters and it all rebuilds. 6× playback. Full video, recorded with the demo script.

Download for Windows Download for macOS Download for Linux Get it from the Snap Store Try it in your browser

The downloads aren't signed yet. On Windows, if SmartScreen warns you, choose More info, then Run anyway. On macOS, the first time, right-click SolidCraft in Applications and choose Open.

Older versions, checksums and other formats are on the releases page. Install details, upgrading from earlier builds and building from source are in Getting started.

Documentation: the SolidCraft book (user guide, developer guide and command reference; sources in docs/book).

Status: early but usable for simple parts. 75 of 76 public reference parts match their analytic or FreeCAD-computed volume, area, centre of mass and bounding box (docs/oracle.md); the other is a tracked bug. These checks do not establish complete geometric or workflow equivalence. The commands SolidCraft has are listed by area in docs/features.md; status and plans are in ROADMAP.md. Open work and known bugs are in GitHub issues, and help is welcome: see CONTRIBUTING.md.

  • 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. Points the constraints fix relative to known geometry are placed exactly by construction (loci intersections and rigid-cluster decomposition, after Owen 1991 and Fudos–Hoffmann 1997); Levenberg–Marquardt solves the rest, and the rank of its Jacobian gives the remaining degrees of freedom. Constraints: coincident, point on curve, horizontal/vertical, parallel, perpendicular, tangent, curvature (G2), equal, concentric, collinear, midpoint, symmetry, fix; linear, aligned, horizontal, vertical, point-to-line, radius, diameter, angle, arc sweep, arc length and slot length dimensions driven by parameters. Over-constraining edits are rejected; fully constrained geometry turns black. Dragging solves the sketch every frame and rebuilds the model once, when the drag ends. Select a line or its two endpoints, type its dimension and press Enter to commit one undo step. Fit keeps sketch geometry clear of the palette and navigation controls.
  • 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: design containers (.solidcraft) with lossless binary mesh payloads; plain JSON remains supported for opening, Save As and export. Desktop Open can show a saved experimental preview (explicit preview: true engine saves) while checking geometry before editing. 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). Convert Mesh reconstructs supported closed constant-section parts as parametric solids with planar and circular cylindrical faces; 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. Feature errors and Help can open an editable Create Issue draft with relevant context and an optional reviewed screenshot; opening GitHub does not submit the report.
  • Headless CLI solidcraft-cli: run command scripts, measure (volume, area, centre of mass, face/edge/vertex counts), export, render PNG snapshots and replay reference recipes.
  • MCP server solidcraft-cli mcp: AI agents model, measure and look at parts headless or in the running app (see below).
cargo run --release -p solidcraft -- --sample          # desktop app with a sample part
cargo run --release -p solidcraft-cli -- commands      # the command registry
cargo run --release -p solidcraft-cli -- run examples/bracket.json --out bracket.step
cargo run --release -p solidcraft-cli -- snapshot examples/bracket.json --out bracket.png
cargo run --release -p solidcraft -- part.step          # open a STEP file as a new design
cargo run --release -p solidcraft-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 solidcraft.

On Windows and Linux, SolidCraft detects a connected 3Dconnexion SpaceNavigator or SpaceMouse through its multi-axis HID interface. Move the cap to pan and zoom, and tilt or twist it to rotate the 3D view. While editing a sketch, the cap pans and zooms without changing the sketch view. The Navigation page in Preferences has an on/off switch and a speed control for the 3D mouse.

On Linux SolidCraft reads /dev/hidrawN directly, so the logged-in user needs access to the device. A udev rule that adds the uaccess tag does that, for example /etc/udev/rules.d/70-3d-mouse.rules for devices with 3Dconnexion's vendor id:

SUBSYSTEM=="hidraw", ATTRS{idVendor}=="256f", TAG+="uaccess"

Older SpaceNavigators use Logitech's vendor id 046d; add a rule with their product id (see lsusb) instead of matching every Logitech device. Reload with sudo udevadm control --reload && sudo udevadm trigger, then replug the device. The Flatpak sandbox does not expose hidraw devices, so the 3D mouse only works with native builds there for now. Devices that send all six axes in HID report 1 (some homemade ones do) are recognised from their report descriptor, so they work as well.

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

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}}
]}

solidcraft-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 solidcraft --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 solidcraft -- solidcraft-cli mcp. Details, client configuration and an example session: docs/mcp.md.

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 solidcraft, solidcraft-cli desktop app, headless CLI

Coming from Autodesk Fusion? SolidCraft uses familiar parametric CAD workflows: constrained sketches, solid features, an editable timeline, parameters and assemblies. See the roadmap for supported operations and current limitations.

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

MIT OR Apache-2.0, at your option. Developed under the clean-room contribution rules; third-party code and assets retain their documented licences and attribution.

SolidCraft is independent. Behaviour is designed from public documentation, general CAD conventions and user feedback. Reference tests use analytic values and open-source tools. SolidCraft is not affiliated with, sponsored by or endorsed by Autodesk. Autodesk and Fusion are trademarks of Autodesk, Inc.

联系我们 contact @ memedata.com