科研 Skill

自然语言参数化CAD建模

parametric-part-cad

Turns a plain-English or dimensioned part description into a parametric CadQuery script and exports STEP, STL, and a mass/volume report. Use when asked to model or generate a CAD part.

发布者 Codar安全审核通过v0.1.0更新于 2026-11-18

SKILL.md

Parametric Part CAD (CadQuery)

Setup

pip install cadquery. If the install fails (some platforms lack OCP wheels), fall back to build123d. The same structure applies.

Workflow

  1. Spec → parameter table. List every dimension as a named parameter, with units in mm. Fill gaps using references/design_defaults.md (clearance holes, wall thickness, fillets) and mark the filled values as assumptions. Ask the user only about dimensions that change function, such as interfaces and mating features.
  2. Choose the datum. State where the origin is and which way +Z points, chosen so that functional faces sit on principal planes.
  3. Write the part script following scripts/example_flanged_bushing.py:
    • a PARAMS dict, updated from OVERRIDES;
    • assert geometry sanity checks (minimum wall, hole-to-edge distance) with readable messages;
    • build order: base solid → bosses and ribs → holes and pockets → fillets → chamfers. Do fillets last; they fail most often;
    • end with result = ...;
    • set DENSITY_KG_M3 to get a mass estimate.
  4. Build and export:
    python scripts/build_part.py part.py --out out/part
    python scripts/build_part.py part.py --out out/part_v2 --set n_bolts=6 --set bore=22
    
    Exit code 2 means the geometry is invalid or not a single solid. Fix it before going further.
  5. Look at the preview. View out/part_preview.png (isometric, top, and front) and check it against the spec. Confirm the bounding box matches the expected envelope.
  6. Deliver the STEP (for CAD), STL (for printing), preview image, parameter table, and the .py file so the user can keep changing it.

Debugging CadQuery

  • A fillet fails (BRep_API: command not done) → reduce the radius, or select edges more narrowly (NearestToPointSelector, .edges("|Z")).
  • A boolean leaves two solids → the features don't overlap. Extend one by 0.01 mm into the other.
  • A hole lands on the wrong face → re-select with .faces(">Z").workplane(centerOption="CenterOfBoundBox").

Assemblies

For multi-part designs, build each part as its own function and combine them with cq.Assembly() and constraints. Export with assy.save("out/assy.step").

示例提示词

帮我根据文字描述生成一个带安装孔的参数化支架CAD模型并导出STEP。

所属插件

机械设计与先进制造面向机械设计与制造研究:文本/草图生成 CAD、FreeCAD/SolidWorks 参数化建模、机构综合与零件选型、公差与 GD&T、DFM 与设计评审、快速有限元与应力代理模型、增材制造工艺与缺陷预测、疲劳断裂寿命。

安装该插件会一并获得同领域的 35 个 Skill / MCP。

同插件的其他科研 Skill

常见问题

自然语言参数化CAD建模能做什么?

Turns a plain-English or dimensioned part description into a parametric CadQuery script and exports STEP, STL, and a mass/volume report. Use when asked to model or generate a CAD part。

如何安装自然语言参数化CAD建模?

在科搭 Codar 左侧点击「插件」,在「组件」页签搜索「自然语言参数化CAD建模」并安装;在 Claude Code 或 Codex 中可以发送本页的安装提示词,或下载 Skill 包后解压到 ~/.claude/skills 或 ~/.codex/skills。

自然语言参数化CAD建模需要哪些权限?

该科研 Skill没有声明额外权限;执行具体操作时仍由 Agent 按自身规则请求确认。

自然语言参数化CAD建模经过官方审核吗?

是。SpeedSkills 收录的每个版本都会记录内容摘要与权限声明,当前版本已通过安全审核。