cad

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CAD generation, inspection, and validation

CAD生成、检查与验证

Purpose

用途

Create or modify parametric CAD models from natural-language requirements, generate validated STEP/STP artifacts, inspect geometry references, and return checked outputs. Treat STEP as the primary CAD artifact. Treat DXF, STL, 3MF, and native GLB as secondary workflows that branch from, or accompany, a STEP-first process. For assemblies, prefer source-level build123d joints and named mating datums when the parts have functional assembly relationships.
根据自然语言需求创建或修改参数化CAD模型,生成经过验证的STEP/STP工件,检查几何引用,并返回已校验的输出。将STEP视为主要CAD工件。将DXF、STL、3MF和原生GLB视为从STEP优先流程分支而来或与之配套的次要工作流。对于装配体,当零件具有功能装配关系时,优先使用源代码级的build123d关节和命名配合基准。

Use this skill when

适用场景

Use this skill when the user asks for CAD files, STEP/STP files, build123d source,
@cad[...]
references, mechanical parts, assemblies, enclosures, brackets, fixtures, holes, counterbores, countersinks, slots, pockets, bosses, standoffs, ribs, fillets, chamfers, shells, source-level joints, mating, or measurements.
Also use it when the user asks for DXF, STL, 3MF, or native GLB output from CAD geometry. Keep those workflows secondary and load
dxf.md
or
supported-exports.md
for details.
Do not use this skill for render-only concept art, CAM toolpaths, engineering certification, FEA conclusions, architectural BIM, or freehand illustration unless the user also needs CAD geometry.
当用户请求CAD文件、STEP/STP文件、build123d源代码、
@cad[...]
引用、机械零件、装配体、外壳、支架、夹具、孔、沉头孔、 countersinks、槽、型腔、凸台、支撑柱、加强筋、圆角、倒角、抽壳、源代码级关节、配合或测量时,使用此技能。
当用户请求从CAD几何生成DXF、STL、3MF或原生GLB输出时,也可使用此技能。这些工作流属于次要流程,如需详细信息可查阅
dxf.md
supported-exports.md
除非用户同时需要CAD几何,否则请勿将此技能用于仅渲染的概念艺术、CAM刀具路径、工程认证、FEA结论、建筑BIM或手绘插图。

Default assumptions

默认假设

Use these defaults unless the user specifies otherwise:
  • Units: millimeters.
  • Origin: center of the main part or assembly unless a mating interface or fixed root component suggests a better origin.
  • Base plane: XY.
  • Up/extrusion axis: positive Z.
  • Output geometry: closed, positive-volume solids unless the user requests surfaces or construction geometry.
  • STEP structure: one valid solid, a compound of solids, or a labeled assembly compound.
  • Assembly structure: fixed root part, part-local frames, named mating datums, build123d joints where applicable, and explicit generated placements.
  • Small plastic enclosure wall: 2.0-3.0 mm when unspecified.
  • Cosmetic fillet: 1.0-3.0 mm when safe for local geometry.
  • M3/M4/M5 normal clearance holes: 3.4/4.5/5.5 mm unless another standard is requested.
Ask one focused clarification question only when missing information makes the model impossible, fit-critical, safety-critical, or compliance-bound. Otherwise proceed with explicit assumptions.
除非用户另有指定,否则采用以下默认设置:
  • 单位:毫米。
  • 原点:主零件或装配体的中心,除非配合接口或固定根组件建议更合适的原点。
  • 基准平面:XY平面。
  • 向上/挤出轴:Z轴正方向。
  • 输出几何:闭合的正体积实体,除非用户要求曲面或构造几何。
  • STEP结构:单个有效实体、实体复合结构或带标签的装配体复合结构。
  • 装配体结构:固定根零件、零件局部坐标系、命名配合基准、适用的build123d关节,以及明确的生成位置。
  • 小型塑料外壳壁厚:未指定时为2.0-3.0毫米。
  • 装饰性圆角:在局部几何允许的情况下为1.0-3.0毫米。
  • M3/M4/M5普通间隙孔:除非要求其他标准,否则孔径为3.4/4.5/5.5毫米。
仅当缺失信息导致模型无法创建、对配合精度有严格要求、涉及安全或合规性时,才提出一个聚焦的澄清问题。否则按明确的假设进行操作。

Natural-language specs only

仅支持自然语言规格

Do not ask the user to provide a JSON specification and do not make JSON the user-facing workflow. Convert the user's prose into an internal CAD brief with dimensions, features, assumptions, output paths, and validation criteria. Use
references/natural-language-specs.md
for brief-writing patterns.
请勿要求用户提供JSON规格,也不要将JSON作为面向用户的工作流。将用户的描述转换为包含尺寸、特征、假设、输出路径和验证标准的内部CAD简要说明。可参考
references/natural-language-specs.md
中的简要说明撰写模式。

Root model

根模型

Keep these roots separate:
  • CAD skill directory: this folder. Tool launchers live here as
    scripts/step
    ,
    scripts/inspect
    , and
    scripts/dxf
    .
  • Tool process cwd: relative CAD targets are resolved from the command's current working directory. Use absolute target paths when running from the skill directory, or run from the workspace root and invoke the launchers with a path to this skill directory.
  • Render: this skill does not own Explorer startup. After creating or modifying supported artifacts, hand off explicit paths to
    $render
    when that skill is available;
    $render
    checks/reuses a live viewer and returns links.
Short command examples in this skill use launcher paths relative to the CAD skill directory. Adapt the launcher path or target path so project CAD files resolve from the intended workspace, not accidentally under the skill directory.
Prefer keeping a STEP output and its Python generator in the same directory so the source stays easy to discover. Unless the user explicitly requests otherwise, keep the STEP basename and generator basename the same even when they cannot live side by side.
请区分以下根目录:
  • CAD技能目录:此文件夹。工具启动器位于
    scripts/step
    scripts/inspect
    scripts/dxf
  • 工具进程当前工作目录:相对CAD目标路径从命令的当前工作目录解析。从技能目录运行时使用绝对目标路径,或从工作区根目录运行并通过路径调用此技能目录中的启动器。
  • 渲染:此技能不负责启动Explorer。创建或修改支持的工件后,若
    $render
    技能可用,将明确的路径传递给它;
    $render
    会检查/复用实时查看器并返回链接。
此技能中的简短命令示例使用相对于CAD技能目录的启动器路径。请调整启动器路径或目标路径,确保项目CAD文件从预期的工作区解析,而非意外存放在技能目录下。
建议将STEP输出及其Python生成器放在同一目录,以便于查找源代码。除非用户明确要求,否则即使无法放在同一目录,也要保持STEP文件名和生成器文件名的基础名称一致。

Available tools

可用工具

From the CAD skill directory, the launcher shape is:
bash
python scripts/step ...
python scripts/inspect ...
python scripts/dxf ...
Use the active project Python interpreter. If only the repo-local virtualenv is available, invoke that interpreter while keeping the root model above explicit.
Use
python scripts/<tool> --help
for the complete current command interface; reference docs show recommended workflows, not every flag.
从CAD技能目录中,启动器的格式如下:
bash
python scripts/step ...
python scripts/inspect ...
python scripts/dxf ...
使用当前项目的Python解释器。若仅可用仓库本地的虚拟环境,调用该解释器时需明确上述根模型。
使用
python scripts/<tool> --help
查看完整的当前命令接口;参考文档展示的是推荐工作流,而非所有标志。

Required workflow

必需工作流

  1. Classify the task. Identify whether this is a new part, new assembly, source modification, direct STEP/STP inspection, reference selection, measurement/mating check, render review, or secondary output request.
  2. Load only the needed references. Use the triggers below instead of reading the whole reference set.
  3. Create a natural-language CAD brief. Extract dimensions, units, coordinate convention, feature intent, output paths, assumptions, and validation targets.
  4. Plan before coding. Define parameters, labels, source paths, expected bounding boxes, and any mating/positioning datums before editing.
  5. Edit source, not generated artifacts. Prefer build123d Python with
    gen_step()
    for STEP generation.
  6. Generate explicit targets. Use
    scripts/step
    for STEP/STP generation and sidecars. Use
    --kind part
    or
    --kind assembly
    only for direct STEP/STP imports. Only ever use
    --skip-explorer
    when the user explicitly asks to skip Explorer, GLB/topology, or renderable topology output. Do not run directory-wide generation.
  7. Validate geometrically. Use
    scripts/inspect refs --facts --planes --positioning
    , then targeted
    measure
    ,
    mate
    ,
    frame
    , or
    diff
    when needed.
  8. Hand off to render. Always pass created or modified
    .step
    ,
    .stp
    ,
    .stl
    ,
    .3mf
    ,
    .dxf
    , or native
    .glb
    paths to
    $render
    for live viewer links when that skill is available.
  9. Tier visual review. For generation feedback, prefer the render skill's snapshot CLI over opening the viewer manually or using Playwright. Use snapshots when still image files are needed for multimodal critique, section/wireframe review, user-facing snapshots, or risk-based semantic validation. For non-trivial parts and assemblies, prefer one small diagnostic still-image packet after geometric validation. Generate GIFs only for STEP-module parameter animation review; otherwise use still snapshots, not GIFs. Do not run repeated snapshots unless a source repair changed visible geometry or a specific visual finding needs confirmation.
  10. Repair and rerun. If a check fails, change the smallest responsible source section, regenerate, and rerun the failed validation.
  1. 任务分类:确定任务是创建新零件、新装配体、修改源代码、直接检查STEP/STP、选择引用、测量/配合检查、渲染审查还是次要输出请求。
  2. 仅加载所需引用:使用以下触发器,而非读取整个引用集。
  3. 创建自然语言CAD简要说明:提取尺寸、单位、坐标约定、特征意图、输出路径、假设和验证目标。
  4. 编码前规划:在编辑前定义参数、标签、源路径、预期边界框以及任何配合/定位基准。
  5. 编辑源代码,而非生成的工件:优先使用带
    gen_step()
    的build123d Python代码生成STEP文件。
  6. 生成明确目标:使用
    scripts/step
    生成STEP/STP工件和附属文件。仅在直接导入STEP/STP时使用
    --kind part
    --kind assembly
    。仅当用户明确要求跳过Explorer、GLB/拓扑或可渲染拓扑输出时,才使用
    --skip-explorer
    。请勿运行目录范围的生成操作。
  7. 几何验证:使用
    scripts/inspect refs --facts --planes --positioning
    ,必要时使用针对性的
    measure
    mate
    frame
    diff
    命令。
  8. 交接至渲染:若
    $render
    技能可用,始终将创建或修改的
    .step
    .stp
    .stl
    .3mf
    .dxf
    或原生
    .glb
    路径传递给它以获取实时查看器链接。
  9. 分层视觉审查:对于生成反馈,优先使用渲染技能的快照CLI,而非手动打开查看器或使用Playwright。当需要静态图像文件进行多模态评审、剖面/线框审查、面向用户的快照或基于风险的语义验证时,使用快照。对于非 trivial 的零件和装配体,建议在几何验证后生成一个小型诊断静态数据包。仅在STEP模块参数动画评审时生成GIF;否则使用静态快照,而非GIF。除非源代码修复改变了可见几何或需要确认特定视觉发现,否则请勿重复生成快照。
  10. 修复并重跑:若检查失败,修改最小范围的相关源代码部分,重新生成并重新运行失败的验证。

Non-negotiables

不可协商规则

  • Treat generated STEP/STP, STL, 3MF, GLB/topology, DXF outputs, and Explorer sidecars as derived artifacts.
  • Keep STEP as the primary validated CAD artifact; DXF/STL/3MF are secondary unless the user explicitly says otherwise.
  • When a Python generator exists, run
    scripts/step
    on the generator. Use a direct STEP/STP target only when the generator is unavailable or the user explicitly identifies that STEP/STP file as the target.
  • Use named parameters, closed solids, explicit labels, and source-controlled geometry intent.
  • Author assembly positioning in source with part-local datums, explicit
    Location
    transforms, or build123d joints. Treat CLI
    inspect mate
    as read-only validation, not as a source-editing API.
  • Do not use
    git status
    ,
    git diff
    , or file-size churn as CAD comparison for large exported STEP/STP, GLB/topology, STL, 3MF, or DXF artifacts. Compare source changes,
    scripts/inspect
    summaries, CAD Explorer renders, or CAD Explorer output instead; use path-limited git status only for bookkeeping.
  • Always hand off supported created or modified artifacts to
    $render
    for live viewer links when that skill is available; report if
    $render
    is unavailable or the viewer check fails.
  • Report only checks that actually ran or are directly supported by tool output.
  • If
    $render
    is unavailable or fails, say so and rely on CLI inspection for validation.
  • 将生成的STEP/STP、STL、3MF、GLB/拓扑、DXF输出和Explorer附属文件视为派生工件。
  • 将STEP作为主要的已验证CAD工件;除非用户明确说明,否则DXF/STL/3MF为次要工件。
  • 若存在Python生成器,对生成器运行
    scripts/step
    。仅当生成器不可用或用户明确指定该STEP/STP文件为目标时,才直接使用STEP/STP目标。
  • 使用命名参数、闭合实体、明确标签和受版本控制的几何意图。
  • 在源代码中使用零件局部基准、明确的
    Location
    变换或build123d关节定义装配体定位。将CLI
    inspect mate
    视为只读验证工具,而非源代码编辑API。
  • 对于大型导出的STEP/STP、GLB/拓扑、STL、3MF或DXF工件,请勿使用
    git status
    git diff
    或文件大小变化作为CAD比较依据。应比较源代码变更、
    scripts/inspect
    摘要、CAD Explorer渲染结果或CAD Explorer输出;仅在记录时使用路径受限的git status。
  • $render
    技能可用,始终将支持的创建或修改工件传递给它以获取实时查看器链接;若
    $render
    不可用或查看器检查失败,需告知用户。
  • 仅报告实际运行的检查或工具输出直接支持的检查。
  • $render
    不可用或失败,需告知用户并依赖CLI检查进行验证。

Progressive references

渐进式引用

Load these files only when their trigger applies:
  • references/natural-language-specs.md
    — converting prose requirements into a CAD brief without requiring user JSON.
  • references/parameters.md
    — parameter, control, and animation design best practices.
  • references/step-generation.md
    — STEP generation, direct STEP/STP targets, part-vs-assembly behavior, and post-generation inspection.
  • references/inspection-and-validation.md
    — validation gates,
    @cad[...]
    refs, facts, planes, topology, measurements, mating, diff, frame, and final validation reporting.
  • references/render-review.md
    — risk-based render triggers, small render packets, targeted visual views, multimodal critique, and converting visual findings into geometry checks.
  • references/positioning.md
    — part-local datums, assembly transforms, build123d joints, CLI mate validation, and positioning reports.
  • references/dxf.md
    — secondary DXF workflow.
  • references/supported-exports.md
    — secondary STL/3MF/native GLB sidecar workflows.
  • references/build123d-modeling.md
    — build123d modeling patterns, topology, selectors, features, assemblies.
  • references/repair-loop.md
    — diagnosis and repair procedures.
Final responses should include generated files, CAD Explorer links when
$render
is available, validation actually run, assumptions, and caveats. Use
references/inspection-and-validation.md
for report structure.
仅当触发条件匹配时加载以下文件:
  • references/natural-language-specs.md
    — 将 prose 需求转换为CAD简要说明,无需用户提供JSON。
  • references/parameters.md
    — 参数、控制和动画设计的最佳实践。
  • references/step-generation.md
    — STEP生成、直接STEP/STP目标、零件与装配体的行为差异,以及生成后检查。
  • references/inspection-and-validation.md
    — 验证关卡、
    @cad[...]
    引用、几何事实、平面、拓扑、测量、配合、差异比较、坐标系和最终验证报告。
  • references/render-review.md
    — 基于风险的渲染触发条件、小型渲染数据包、针对性视觉视图、多模态评审,以及将视觉发现转换为几何检查。
  • references/positioning.md
    — 零件局部基准、装配体变换、build123d关节、CLI配合验证和定位报告。
  • references/dxf.md
    — 次要DXF工作流。
  • references/supported-exports.md
    — 次要STL/3MF/原生GLB附属工作流。
  • references/build123d-modeling.md
    — build123d建模模式、拓扑、选择器、特征、装配体。
  • references/repair-loop.md
    — 诊断和修复流程。
最终响应应包含生成的文件、
$render
可用时的CAD Explorer链接、实际执行的验证操作、假设和注意事项。可参考
references/inspection-and-validation.md
中的报告结构。