闲社服务运行正常AI智能体自动化平台
b

build123d三维建模

技能标识:build123d-cad

Parametric 3D CAD via build123d. Generate STEP, STL, SVG from Python scripts. Use when the user asks to design, model, create, or export 3D parts, enclosures, mounts, brackets, or mechanical components.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.1.2
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

build123d三维建模

build123d CAD

通过build123d实现参数化3D CAD。该技能提供用于生成和测量3D实体的Python脚本。使用exec工具运行它们。

设置(仅首次)

bash
cd {baseDir}
uv venv --python 3.12
uv pip install build123d

命令

所有脚本均使用位于{baseDir}/.venv/bin/python的虚拟环境Python。所有输出均为JSON格式到标准输出。

生成 — 导出STEP/STL/SVG

bash
{baseDir}/.venv/bin/python {baseDir}/scripts/cad_generate.py \
--script from build123d import *
with BuildPart() as result:
Box(100, 60, 40) \
--format step \
--filename my_box

输出:{ success: true, artifactpath: ..., format: step, filesizebytes: N, boundingbox_mm: {...} }

测量 — 尺寸、体积、质量

bash
{baseDir}/.venv/bin/python {baseDir}/scripts/cad_measure.py \
--script from build123d import *
with BuildPart() as result:
Cylinder(10, 50)

输出:{ success: true, boundingboxmm: {...}, volumemm3: N, surfaceareamm2: N, centerofmassmm: {...}, facecount: N, edgecount: N }

截面 — 2D横截面SVG

bash
{baseDir}/.venv/bin/python {baseDir}/scripts/cad_section.py \
--script ... \
--plane XY \
--offset 5.0

输出:{ success: true, artifactpath: ..., plane: XY, offsetmm: 5.0 }

API参考 — build123d速查表

bash
{baseDir}/.venv/bin/python {baseDir}/scripts/cad_api.py

输出:包含基本体、操作、选择器、导出函数的JSON。如果需要了解可用功能,请先调用此命令。

验证 — 干涉、间隙、扫掠体积碰撞

检查多零件装配体的干涉、最小间隙和运动部件碰撞。

bash
{baseDir}/.venv/bin/python {baseDir}/scripts/cad_validate.py \
--script ... \
--mode full \
--min-clearance 1.0

模式:static(所有零件对之间的布尔交集),clearance(边界框间隙),sweep(在角度范围内旋转运动部件,检查碰撞),full(全部三种,默认)。

脚本必须定义parts = {name: solid, ...}字典。可选定义运动部件的sweeps列表:

python
from build123d import *

with BuildPart() as enclosure:
Box(100, 80, 50)
offset(amount=-3, openings=enclosure.faces().sort_by(Axis.Z)[-1:])

with BuildPart() as pcb:
with Locations((0, 0, 5)):
Box(60, 40, 2)

with BuildPart() as servo_arm:
with Locations((30, 0, 25)):
Box(5, 20, 3)

parts = {
enclosure: enclosure.part,
pcb: pcb.part,
servoarm: servoarm.part,
}

sweeps = [
{
name: servo_arm,
axis_origin: (30, 0, 25),
axis_direction: (0, 1, 0),
angle_start: -45,
angle_end: 45,
angle_step: 5,
},
]

输出:{ verdict: PASS|WARN|FAIL, staticinterference: {...}, clearance: {...}, sweptvolume: {...} }

  • - PASS — 无干涉,间隙正常
  • WARN — 间隙低于阈值但无硬碰撞
  • FAIL — 零件相交或运动部件在扫掠过程中碰撞

扫掠体积导出到~/.openclaw/workspace/cad-output/swept_.step用于可视化。

脚本格式

所有单零件脚本必须通过BuildPart上下文将最终实体赋值给result:

python
from build123d import *

with BuildPart() as result:
Box(100, 60, 40)
fillet(result.edges().filter_by(Axis.Z), radius=5)
with Locations((0, 0, 40)):
CounterBoreHole(radius=5, counterboreradius=8, counterboredepth=3, depth=40)

对于验证脚本,定义parts字典(以及可选的sweeps列表)代替result。

所有尺寸单位为毫米。导出文件保存到~/.openclaw/workspace/cad-output/。

工作流程

  1. 1. 如果不确定build123d API,先运行cadapi.py获取速查表。
  2. 编写参数化脚本(无魔法数字)。
  3. 在导出前运行cadmeasure.py验证尺寸。
  4. 对于多零件装配体:在导出前运行cadvalidate.py --mode full。 在继续之前修复任何FAIL/WARN。
  5. 使用所需格式运行cadgenerate.py(step用于CAD,stl用于3D打印)。
  6. 对于间隙可视化,在相关平面上运行cad_section.py。
  7. 报告工件路径和验证结论。

设计规则

  • - 将所有尺寸参数化以便重用。
  • 在应力集中处添加圆角(塑料至少1mm,金属0.5mm)。
  • 在适用处包含安装特征(凸台、支柱、螺丝柱)。
  • 在注释中指定材料和工艺假设。
  • 同时输出脚本和导出文件。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 build123d-cad-1776086245 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 build123d-cad-1776086245 技能

通过命令行安装

skillhub install build123d-cad-1776086245

下载

⬇ 下载 build123d-cad v1.1.2(免费)

文件大小: 13.57 KB | 发布时间: 2026-4-14 14:15

v1.1.2 最新 2026-4-14 14:15
- Improved helpers and corresponding test coverage.
- Updated internals in scripts/helpers.py and tests/test_scripts.py.
- No changes to published documentation or skill interface.
返回顶部