solidcraft
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSolidCraft
SolidCraft
Operate SolidCraft (an open-source parametric CAD app in Rust: desktop, web, headless CLI, MCP) through its structured automation interface. Preserve the user's requested modelling workflow and target design.
通过结构化自动化接口操作 SolidCraft(一个用 Rust 编写的开源参数化 CAD 应用,支持桌面端、Web 端、无头 CLI 和 MCP)。遵循用户指定的建模工作流和目标设计。
Protocol reference
协议参考
Read the relevant sections of references/control-protocol.md before constructing calls, and references/mcp.md for the MCP tool surface. These are downloaded upstream docs, captured from upstream on 2026-11-02 for SolidCraft 0.30.x; upstream lives at github.com/tangency-labs/solidcraft (). Relative links inside them (e.g. , ) resolve against ; and are also in . The protocol lists methods, not individual modelling commands: discover those at runtime instead of inventing command IDs or parameters.
maindocs/render-jobs.mdscripts.mdhttps://github.com/tangency-labs/solidcraft/blob/main/docs/render-jobs.mdscripts.mdreferences/构建调用前,请阅读 references/control-protocol.md 的相关章节,并阅读 references/mcp.md 以了解 MCP 工具接口。这些是从上游下载的文档,捕获自 2026-11-02 的上游 分支,对应 SolidCraft 0.30.x;上游仓库位于 github.com/tangency-labs/solidcraft()。其中的相对链接(例如 、)基于 https://github.com/tangency-labs/solidcraft/blob/main/docs/ 解析; 和 也位于 中。该协议列出的是方法,而不是单独的建模命令:应在运行时发现这些命令,不要臆造命令 ID 或参数。
maindocs/render-jobs.mdscripts.mdrender-jobs.mdscripts.mdreferences/Locate the executables
定位可执行文件
solidcraftsolidcraft-cliPATH- PATH: (POSIX) or
command -v solidcraft solidcraft-cli(Windows).where solidcraft solidcraft-cli - macOS: ; the binaries are
mdfind -name SolidCraft.appand/Applications/SolidCraft.app/Contents/MacOS/SolidCraft(both ship in the same bundle)..../solidcraft-cli - Linux: the AppImage, , or the shortcut's target.
/snap/bin/solidcraft - Nothing to install to drive it. The control port is plain line-delimited JSON over loopback TCP; is a small dependency-free wrapper, and any language that opens a socket works.
scripts/sc.pyis only needed for the MCP bridge and headless runs.solidcraft-cli
即使应用已安装, 和 通常也不在 中。请务必先发现其位置,不要猜测路径:
solidcraftsolidcraft-cliPATH- PATH: (POSIX)或
command -v solidcraft solidcraft-cli(Windows)。where solidcraft solidcraft-cli - macOS: ;可执行文件为
mdfind -name SolidCraft.app和/Applications/SolidCraft.app/Contents/MacOS/SolidCraft(二者都位于同一个应用包中)。.../solidcraft-cli - Linux: AppImage、,或快捷方式的目标路径。
/snap/bin/solidcraft - 驱动它无需安装任何额外组件。 控制端口通过回环 TCP 传输按行分隔的 JSON;是一个无依赖的小型包装器,任何能够打开 socket 的语言都可以使用它。只有 MCP 桥接和无头运行时才需要
scripts/sc.py。solidcraft-cli
Start and select a session
启动并选择会话
-
Watchable session (default choice): start the desktop app with a control port, then drive that live window so the user sees the model appear.sh
SOLIDCRAFT_CONTROL_PORT=7878 /Applications/SolidCraft.app/Contents/MacOS/SolidCraft >/tmp/solidcraft.log 2>&1 & -
Bridged MCP for an MCP-capable client:(tools:
solidcraft-cli mcp --connect 127.0.0.1:7878,execute,batch,inspect_design,measure,body_topology,set_parameter,check_parameters,screenshot,compare_picture,export,open,save,new_design,undo,redo,list_commands,describe_command,pending,running,crash_reports).skill_reference -
Headless (with no
solidcraft-cli mcp, or--connect) has its own in-process design and cannot touch the user's open window. Use it for unattended file processing.solidcraft-cli run script.json
Reuse a running instance when one exists () and keep the channel on loopback.
pgrep -lf SolidCraftAuthentication: each launch mints a random token and writes it, hex, to a file the app removes on exit — macOS , Linux , Windows . Send it as a top-level on the first request of a connection; later requests may omit it. A wrong or missing token answers and closes. Set (≥32 hex chars) to pin one; prefer the variable over , which other users can see in the process list.
0600~/Library/Application Support/SolidCraft/control/PORT.token$XDG_DATA_HOME/solidcraft/control/PORT.token%LOCALAPPDATA%\SolidCraft\control\PORT.token"token"unauthorizedSOLIDCRAFT_CONTROL_TOKEN--token-
可观察会话(默认选择): 使用控制端口启动桌面应用,然后驱动这个实时窗口,让用户看到模型的创建过程。sh
SOLIDCRAFT_CONTROL_PORT=7878 /Applications/SolidCraft.app/Contents/MacOS/SolidCraft >/tmp/solidcraft.log 2>&1 & -
MCP 桥接:适用于支持 MCP 的客户端;执行(工具包括:
solidcraft-cli mcp --connect 127.0.0.1:7878、execute、batch、inspect_design、measure、body_topology、set_parameter、check_parameters、screenshot、compare_picture、export、open、save、new_design、undo、redo、list_commands、describe_command、pending、running、crash_reports)。skill_reference -
无头模式(不带的
--connect,或solidcraft-cli mcp)拥有独立的进程内设计,无法操作用户已打开的窗口。适用于无人值守的文件处理。solidcraft-cli run script.json
如果已有实例正在运行(),应复用该实例,并确保通信通道使用回环地址。
pgrep -lf SolidCraft身份验证: 每次启动都会生成一个随机 token,以十六进制形式写入权限为 的文件;应用退出时会删除该文件。文件位置为:macOS 的 、Linux 的 、Windows 的 。在连接的首个请求中,将 token 作为顶层 字段发送;后续请求可以省略。token 错误或缺失会返回 并关闭连接。可设置 (至少 32 个十六进制字符)来固定 token;应优先使用环境变量,而不是其他用户可在进程列表中看到的 参数。
0600~/Library/Application Support/SolidCraft/control/PORT.token$XDG_DATA_HOME/solidcraft/control/PORT.token%LOCALAPPDATA%\SolidCraft\control\PORT.tokentokenunauthorizedSOLIDCRAFT_CONTROL_TOKEN--tokenDiscover commands before using them
使用前发现命令
engine.commandssolidcraft-cli commandslist_commandsdescribe_commandengine.describe {command}- —
sketch.*,create,line,circle.center,rectangle.two_point,arc.three_point,spline.fit_point,slot.center_point,polygon.*,text,point,construction,dimension(and the otherconstraint.concentricrelations),constraint.*,trim,fillet,chamfer.*,mirror,pattern.rectangular,pattern.circular,solve,inspect.finish - — features
solid.*,extrude,revolve,sweep,loft,fillet,chamfer,shell,draft,hole,thread,coil,rib,web,press_pull,pipe,emboss,boundary_fill,offset_face,replace_face,split_body,split_face,combine,remove,move,scale,mirror; patternsalign,pattern.rectangular,pattern.circular; direct primitivespattern.path,box,cylinder,sphere,torus(each takes anbounding_solidofoperation/new/cut).join - ,
face.*,body.*(flange, hem, fold, unfold, flat pattern,sheet.*),convert/assembly.*/joint.*/contact.*/motion.*,explode.*,parameters.*,config.*,timeline.*(planes, axes),construct.*,surface.*,mesh.*/material.*,appearance.*/document.*/doc.*,file.*,view.*,browser.*/select.*,selection.*(inspect.*,measure,section,interference,clearance,draft,curvature_map,center_of_mass),minimum_radius,render.*(edit.*,undo,redo,checkpoint),restore_checkpoint.diagnostics.*
engine.commandssolidcraft-cli commandslist_commandsdescribe_commandengine.describe {command}- —
sketch.*、create、line、circle.center、rectangle.two_point、arc.three_point、spline.fit_point、slot.center_point、polygon.*、text、point、construction、dimension(以及其他constraint.concentric关系)、constraint.*、trim、fillet、chamfer.*、mirror、pattern.rectangular、pattern.circular、solve、inspect。finish - — 特征:
solid.*、extrude、revolve、sweep、loft、fillet、chamfer、shell、draft、hole、thread、coil、rib、web、press_pull、pipe、emboss、boundary_fill、offset_face、replace_face、split_body、split_face、combine、remove、move、scale、mirror;阵列:align、pattern.rectangular、pattern.circular;直接基元:pattern.path、box、cylinder、sphere、torus(每个基元都可将bounding_solid设为operation/new/cut)。join - 、
face.*、body.*(flange、hem、fold、unfold、flat pattern、sheet.*)、convert/assembly.*/joint.*/contact.*/motion.*、explode.*、parameters.*、config.*、timeline.*(平面、轴)、construct.*、surface.*、mesh.*/material.*、appearance.*/document.*/doc.*、file.*、view.*、browser.*/select.*、selection.*(inspect.*、measure、section、interference、clearance、draft、curvature_map、center_of_mass)、minimum_radius、render.*(edit.*、undo、redo、checkpoint)、restore_checkpoint。diagnostics.*
Inspect, edit, and verify
检查、编辑与验证
Inspect first: for parameters, timeline (errors, warnings, timings), bodies, sketches, selection and undo depth; for the camera, active tool or dialog, status line, hover, and a pending file picker (). The app may already hold a design you did not create.
document.inspectui.inspectfile_picker_busyEdit with (one command, never opens a dialog) or — a batch runs in one frame, stops at the first failure, and restores an engine checkpoint, reporting //. Batch refuses any step that loads a file (, , ) and any step while the agent cursor is shown: send those one at a time.
engine.execute {command, params}engine.batch {commands, rollback}failed.indexfailed.commandfailed.errordoc.openfile.insert_stepfile.insert_meshVerify numerically, not by eye alone: (volume mm³, area mm², centre of mass, bbox, face/edge/vertex counts, totals; MCP exposes the same as its tool), for the faces and edge midpoints to pick for fillets and chamfers, and with for picked geometry (a cylindrical face reports , , , ). Check a result against an analytic value before telling the user a part is correct.
engine.execute inspect.measure {bodies?}measurebody_topologyinspect.measureitemsdiameterradiuscenteraxisTo change an existing feature, read it with and write it back with (e.g. ) rather than rebuilding the part.
engine.execute timeline.inspect {feature}timeline.edit {feature, set}{"extent": {"distance": "30"}}Sketch notes: every mutating reply carries with stable ids (, , ) that go straight into later commands. A bare numeric is read in the design's units, exactly as typed in the dimension box; pass or to pin units. Point coordinates are always millimetres. Angles are degrees unless an expression says otherwise — except camera //, which are radians, unlike 's .
sketch.*created: {points, curves, constraints, dimensions}l1c1k1sketch.dimensionvalue"50 mm""0.5 in"yawpitchrollsolid.moveangle先进行检查:通过 获取参数、时间线(错误、警告、耗时)、实体、草图、选择状态和撤销深度;通过 获取相机、当前工具或对话框、状态栏、悬停信息及待处理的文件选择器()。应用中可能已经存在一个并非由你创建的设计。
document.inspectui.inspectfile_picker_busy使用 进行编辑(一次执行一个命令,且不会打开对话框),或使用 。批处理会在一帧内运行,在首次失败时停止,并恢复引擎检查点,同时报告 //。批处理拒绝执行任何加载文件的步骤(、、),也会拒绝在显示 Agent 光标时执行步骤:这些步骤必须逐个发送。
engine.execute {command, params}engine.batch {commands, rollback}failed.indexfailed.commandfailed.errordoc.openfile.insert_stepfile.insert_mesh应进行数值验证,而不能只凭肉眼判断:通过 获取体积 mm³、面积 mm²、质心、边界框以及面、边、顶点的数量和总计(MCP 的 工具提供相同功能);使用 查看面和边中点,以选择适合进行 fillet 和 chamfer 的位置;使用带 的 检查选定的几何对象(圆柱面会报告 、、、)。在告知用户零件正确之前,应将结果与解析值进行比较。
engine.execute inspect.measure {bodies?}measurebody_topologyitemsinspect.measurediameterradiuscenteraxis要修改现有特征,请使用 读取特征,再使用 写回修改(例如 ),而不是重新构建零件。
engine.execute timeline.inspect {feature}timeline.edit {feature, set}{"extent": {"distance": "30"}}草图说明:每个会修改状态的 响应都会包含 ,并提供可直接用于后续命令的稳定 id(、、)。 中仅包含数值的 会按照设计所用单位读取,与在尺寸框中输入的值完全一致;传入 或 可明确指定单位。点坐标始终以毫米为单位。除非表达式另有说明,角度默认使用度数;但相机的 // 使用弧度,这与 的 不同。
sketch.*created: {points, curves, constraints, dimensions}l1c1k1sketch.dimensionvalue"50 mm""0.5 in"yawpitchrollsolid.moveangleWatch the user's window, and take pictures
观察用户窗口并截图
ui.render {path, width?, height?, grid?, axes?}ui.screenshot {path}no frame was presented (window hidden?)osascript -e 'tell application "System Events" to set frontmost of (first process whose unix id is PID) to true'ui.renderui.view {view, animate}ui.camera {target, yaw, pitch, distance, fit}ui.worldToScreenFor real UI work (a dialog the engine cannot reach, or showing the user a workflow): names toolbar buttons (), tabs (), panels and browser rows (); // inject pointer input in screen points, / keyboard input, opens a command's dialog, , , and handle menus, dialog inputs, rollback-to-feature and delete confirmations. One pointer event per frame. makes glide the pointer to each pick so the run reads like a person modelling.
ui.handlestoolbar:<command id>tab:Modelrow:<label>ui.clickui.moveui.dragui.keyui.textui.start {command, params}ui.menuPickui.selectionui.editFeatureui.confirmui.agent_cursor {show: true}engine.executeui.render {path, width?, height?, grid?, axes?}ui.screenshot {path}no frame was presented (window hidden?)osascript -e 'tell application "System Events" to set frontmost of (first process whose unix id is PID) to true'ui.renderui.view {view, animate}ui.camera {target, yaw, pitch, distance, fit}ui.worldToScreen对于实际的 UI 操作(引擎无法访问的对话框,或向用户展示某个工作流): 可获取工具栏按钮()、标签页()、面板和浏览器行()的名称;// 以屏幕坐标注入指针输入,/ 提供键盘输入; 打开命令对话框;、、 和 分别处理菜单、对话框输入、回退到特征及删除确认。每帧只能发送一个指针事件。 会让 将指针平滑移动到每个选取位置,使执行过程看起来像人在建模。
ui.handlestoolbar:<command id>tab:Modelrow:<label>ui.clickui.moveui.dragui.keyui.textui.start {command, params}ui.menuPickui.selectionui.editFeatureui.confirmui.agent_cursor {show: true}engine.executeFiles, export, and access rules
文件、导出与访问规则
file.newdoc.open {path}file.save [path]file.export {path, format}up: "y"The MCP server restricts file paths to the open design's folder (only when strictly inside your home folder and not in a hidden folder), SolidCraft's recovery folder, and its scratch folder; widen with (repeatable) or lift with . Raw control requests are unlimited for a token holder; a request may pass to confine itself.
--allow-path DIR--allow-any-pathallow_pathsfile.newdoc.open {path}file.save [path]file.export {path, format}up: "y"MCP 服务器会将文件路径限制在已打开设计所在的文件夹(该文件夹必须严格位于用户主目录内且不是隐藏文件夹)、SolidCraft 的恢复文件夹及其临时文件夹内;可通过重复使用 扩大范围,也可使用 解除限制。持有 token 的用户发出的原始控制请求不受数量限制;单个请求可以传入 来进一步限制自身可访问的路径。
--allow-path DIR--allow-any-pathallow_pathsSlow commands, timeouts, and uncertain outcomes
慢速命令、超时与不确定结果
A request unanswered for 60 s (3600 s for ) replies . That is not a failure — the command may still apply, so never blindly resend a mutation. Ask (whole app, never blocks) and (this connection's outstanding request, then its reply once, exactly once); while one is pending every other request on that connection replies . and wait far longer than 60 s on the socket, so bridged calls usually just answer late. Render jobs (///) are the non-blocking path for product images.
engine.batchtimeout: … is still runningcontrol.runningcontrol.pendingbusysolidcraft-cli mcpscripts/sc.pyrender.startstatuscancelexport请求在 60 秒内未响应时( 为 3600 秒),会返回 。这并不表示失败——命令仍可能生效,因此绝不要盲目重新发送修改操作。查询 (检查整个应用,永不阻塞)和 (先检查当前连接尚未完成的请求,然后恰好接收一次对应响应);当某个请求处于 pending 状态时,该连接上的其他请求都会返回 。 和 在 socket 上等待的时间远长于 60 秒,因此桥接调用通常只是响应较晚。渲染任务(///)是生成产品图片的非阻塞方式。
engine.batchtimeout: … is still runningcontrol.runningcontrol.pendingbusysolidcraft-cli mcpscripts/sc.pyrender.startstatuscancelexportHeadless and scripts
无头模式与脚本
solidcraft-cli run <script.json|design.sc|part.step> [--in F] [--out F]... [--results] [--timings] [--profile]references/scripts.mdevalscriptsnapshot --in design --out shot.png [--view iso|--camera JSON] [--section z=27] [--body Name:color=#rrggbb]recipeoraclefuzzgpucrashessolidcraft-cli --helpsolidcraft-cli run <script.json|design.sc|part.step> [--in F] [--out F]... [--results] [--timings] [--profile]references/scripts.mdevalscriptsnapshot --in design --out shot.png [--view iso|--camera JSON] [--section z=27] [--body Name:color=#rrggbb]recipeoraclefuzzgpucrashessolidcraft-cli --helpOptional deeper guidance
可选的深入指南
Upstream ships four agent skills for the modelling workflow itself — , , , — under . Fetch the relevant one when a task is a full part build, an edit to an existing design, regression checking, or an assembly with joints and motion studies.
solidcraft-modelingsolidcraft-editingsolidcraft-checkingsolidcraft-mechanismsskills/上游为建模工作流本身提供了四个 Agent skill——、、、——位于 。当任务涉及完整零件构建、编辑现有设计、回归检查,或包含关节与运动研究的装配体时,应获取对应的 skill。
solidcraft-modelingsolidcraft-editingsolidcraft-checkingsolidcraft-mechanismsskills/