cad
它能做什么
这个技能指导你的 AI 使用 text-to-cad 制作和编辑参数化的 3D CAD 模型。适合用文字描述零件、并希望得到 3D 模型的设计师和工程师。
适用场景
- ✓当你希望根据描述创建一个新的 3D 零件或装配体时。
- ✓当你需要编辑现有的 CAD 模型脚本,并看到结果随之更新时。
- ✓当你希望把模型导出为 STEP、STL、3MF 或 GLB 文件时。
技能链接
https://github.com/earthtojake/text-to-cad/blob/main/skills/cad/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“能为一个带有两个安装孔的支架建模,并导出为 STEP 文件吗?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 编写或编辑一个 Python build123d 模型。text-to-cad 服务器重新构建它,查看器随之更新。只有在你要求时才会导出文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
CAD modeling and inspection
A model is a Python function; running its script rebuilds it in text-to-cad's warm server, and the page the person has open updates. Files are exports, made when asked.
Start with the task
| Task | Start with | Reference |
|---|---|---|
| Create or edit a part or assembly | The project's model script, or a new one (below). | Models, build123d, positioning |
| Organize a CAD project | The project's existing layout. | Project layout |
| Export STEP, STL, 3MF, GLB or xbf | cad export <id> <file>. |
Exports |
| Use a vendor STEP, an xbf or a scan in a model | read_step, read_xbf or read_mesh in the body. |
Inputs |
| Resolve a reference from a prompt | cad inspect <id> '<ref>'. |
References |
| Measure or check geometry | A check script that calls the model. | Inspection |
| See a model, a view or a pose | cad snapshot <id> out.png. |
Snapshots |
| Articulate a mechanism | build123d joints in the body, then cad.ap242. |
Kinematics |
| Explode, reveal or showcase a model | cad.gltf's animation() in the body. |
Animation |
| Open an existing XBF, STEP/STP, STL, 3MF or GLB | Show it to the user. | Show the model |
Setup and paths
Run the cad command (~/.local/bin/cad where ~/.local/bin is not on your PATH, or where a
project's environment puts its own cad first; cad.cmd on Windows). If cad is not found and
the CAD app was only just added, its server may still be starting: wait five seconds and run the
command again, for up to a minute, before anything else. Otherwise install text-to-cad, outside a sandbox or with its permission:
curl -fsSL https://texttocad.dev/install.sh | sh
On Windows, in PowerShell: irm https://www.texttocad.dev/install.ps1 | iex. Any other failure
says what to do, and cad doctor explains the installation.
One server runs for the installation: the first run starts it, every run and every
command goes through it, and it serves the viewer. cad status lists its workers
and the documents it holds; cad stop stops it.
A build cut off by the shell's time limit keeps running in the server; run the same
command again and it waits for that build and replays it (cad status shows it).
Give a cold build of a large model the shell tool's longest timeout, or run it in the
background.
Build every model with cad run. It needs nothing set up: it runs a script in the server's own
environment, which holds the library and build123d. A model that needs another package names it
at the top of its script, and cad run installs it beside the kernel once, in an environment it
keeps for the runs after:
# /// script
# dependencies = ["pandas>=2"]
# ///
For a one-off, cad run --with pandas src/plate.py (repeat --with, or separate requirements
with commas; a local folder or wheel works too, its path relative to the working directory, or in
the block to the script's folder, and the next run installs it again after an edit). What cannot be
installed beside the kernel is refused in one
line with uv's reason: change the requirement it names, or, where the network is needed once, run
it outside a sandbox or with its permission. In Windows PowerShell, put a version constraint (>=,
<) in the block, not on the command line: PowerShell hands it to cad.cmd unquoted, and cmd reads
> as a redirection.
Command-line paths, and the paths read_step, read_xbf, read_mesh and export
take, are relative to the working directory, as are a model's own file reads. Anchor
them on __file__ in code that must run from any folder.
Write a model and run it
A part or an assembly is a function with no parameters, decorated @model (or with its
file decorators, never both), that returns a build123d shape. Its dimensions are the
arguments of a plain helper function, and each configuration is a @model of its own, with
its own id and page; constants several models share live in a module they import. A call
builds it and returns its document: a handle with .id,
常见问题
什么是 build123d?
它是一个用于构建 3D 形状的 Python 库。该技能用它以代码描述零件。
我需要自己写代码吗?
不需要。AI 会根据你的描述编写脚本,你也可以加以审阅。
它能测量零件吗?
能。技能包含从模型中测量几何形状的检查。
详情
作者的原始描述
Creates and edits parametric CAD parts and assemblies as Python build123d models that text-to-cad's server builds and the CAD Viewer shows live; exports STEP, STL, 3MF, GLB and xbf files on request; resolves prompt references, measures geometry, and articulates or animates assemblies. Use for 3D CAD modeling, editing a model script (any change to a part's or assembly's `.py`), organizing a CAD project, exporting or converting CAD files, Quick Edit prompts, mechanisms, and explode or showcase animations. Opens and reviews existing XBF, STEP/STP, STL, 3MF and GLB files in the CAD Viewer. Covers
repo: earthtojake/text-to-cad
热度
- GitHub 星标
- 25k
- 排名
- #10067
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …