← 返回 Skills 市场
wngfra

Build123d Cad

作者 wngfra · GitHub ↗ · v1.1.2 · MIT-0
cross-platform ⚠ suspicious
424
总下载
1
收藏
0
当前安装
4
版本数
在 OpenClaw 中安装
/install 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...
使用说明 (SKILL.md)

build123d CAD

Parametric 3D CAD via build123d. This skill provides Python scripts for generating and measuring 3D solids. Run them with the exec tool.

Setup (first time only)

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

Commands

All scripts use the venv Python at {baseDir}/.venv/bin/python. All output JSON to stdout.

Generate — export STEP/STL/SVG

{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

Output: { "success": true, "artifact_path": "...", "format": "step", "file_size_bytes": N, "bounding_box_mm": {...} }

Measure — dimensions, volume, mass

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

Output: { "success": true, "bounding_box_mm": {...}, "volume_mm3": N, "surface_area_mm2": N, "center_of_mass_mm": {...}, "face_count": N, "edge_count": N }

Section — 2D cross-section SVG

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

Output: { "success": true, "artifact_path": "...", "plane": "XY", "offset_mm": 5.0 }

API Reference — build123d cheatsheet

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

Output: JSON with primitives, operations, selectors, export functions. Call this first if you need to learn what's available.

Validate — interference, clearance, swept-volume collision

Check an assembly of multiple parts for interference, minimum clearance, and moving-part collisions.

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

Modes: static (Boolean intersection between all pairs), clearance (bounding box gap), sweep (rotate moving parts through angular range, check collisions), full (all three, default).

The script must define parts = {"name": solid, ...} dict. Optionally define sweeps list for moving parts:

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,
    "servo_arm": servo_arm.part,
}

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

Output: { "verdict": "PASS|WARN|FAIL", "static_interference": {...}, "clearance": {...}, "swept_volume": {...} }

  • PASS — no interference, clearance OK
  • WARN — clearance below threshold but no hard collision
  • FAIL — parts intersect or moving parts collide during sweep

Swept volumes are exported to ~/.openclaw/workspace/cad-output/swept_\x3Cname>.step for visualization.

Script Format

All single-part scripts must assign the final solid to result via a BuildPart context:

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, counter_bore_radius=8, counter_bore_depth=3, depth=40)

For validation scripts, define parts dict (and optionally sweeps list) instead of result.

All dimensions in millimeters. Exported files go to ~/.openclaw/workspace/cad-output/.

Workflow

  1. If unsure about build123d API, run cad_api.py first for the cheatsheet.
  2. Write a parameterized script (no magic numbers).
  3. Run cad_measure.py to verify dimensions before exporting.
  4. For multi-part assemblies: run cad_validate.py --mode full before exporting. Fix any FAIL/WARN before proceeding.
  5. Run cad_generate.py with the desired format (step for CAD, stl for 3D printing).
  6. For clearance visualization, run cad_section.py at relevant planes.
  7. Report artifact paths and validation verdict.

Design Rules

  • Parameterize all dimensions for reusability.
  • Add fillets to stress concentrations (min 1mm for plastic, 0.5mm for metal).
  • Include mounting features (bosses, standoffs, screw posts) where applicable.
  • Specify material and process assumptions in comments.
  • Output both the script and the exported file.
安全使用建议
This skill appears coherent and implements a sandbox to run user-provided build123d scripts. Before installing, consider: (1) you will need to create a Python venv and pip-install build123d (outbound network access to PyPI); (2) the sandbox uses regex-based static checks to block dangerous imports/patterns — helpful but not a formal proof against creative escapes, so avoid running it in an environment containing sensitive credentials or production venvs; (3) the helper will inherit VIRTUAL_ENV if your agent is running inside a venv, so create and activate a dedicated venv for this skill to ensure the subprocess runs with the intended packages; (4) exported artifacts are written to your workspace (~/.openclaw/workspace/cad-output by default), so check that path if you want to restrict where files are created. If you need stronger guarantees, review/modify the validate_script rules or run the scripts in an isolated environment (container/VM) before enabling for autonomous use.
功能分析
Type: OpenClaw Skill Name: build123d-cad Version: 1.1.2 The skill provides a suite of tools for 3D CAD generation by executing user-provided Python scripts via a subprocess. While it attempts to implement a sandbox in `helpers.py` using a whitelist of allowed imports and a regex-based blacklist of dangerous patterns (e.g., `os.system`, `eval`, `subprocess`, `socket`), this approach is inherently vulnerable to bypasses through string obfuscation or attribute access. Although the behavior is aligned with the stated purpose and includes defensive tests in `tests/test_scripts.py`, the core functionality relies on a high-risk execution model that could be exploited for remote code execution (RCE) if the sandbox is circumvented.
能力评估
Purpose & Capability
Name/description (parametric CAD via build123d) matches the actual code and runtime behavior: the scripts generate STEP/STL/SVG, measure geometry, create sections, and validate assemblies. The only declared binary is python3, which is appropriate. No unrelated credentials, config paths, or extraneous binaries are requested.
Instruction Scope
SKILL.md instructs creating a virtualenv and installing build123d (expected). Runtime instructions and script APIs are narrowly scoped to CAD tasks. The runtime inserts user code into sandboxed Python scripts and runs them; the helper enforces a static whitelist/blacklist on the user-submitted code. Note: the sandboxing is implemented via static regex checks and import whitelisting on the user code slice — this limits many risky operations, but static checks are not a perfect guarantee against creative escapes.
Install Mechanism
There is no automated install spec (instruction-only). SKILL.md asks the user to create a venv and pip install build123d — a normal, low-risk approach but it does require outbound network access to PyPI (or other configured pip sources). No downloads from untrusted URLs or archive extraction are present in the skill bundle itself.
Credentials
The skill requires no credentials or config paths. The helper runtime purposely constructs a small clean environment for subprocesses (PATH, HOME set to tmpdir, TMPDIR, PYTHONDONTWRITEBYTECODE, and explicit _RESULT_PATH/_WORKSPACE). One subtlety: if the parent process has VIRTUAL_ENV set, run_sandboxed propagates VIRTUAL_ENV and prefixes PATH with that venv — this is practical for ensuring the venv's Python is used but means the subprocess will run with whatever packages are available in that venv; ensure the venv used is the intended one.
Persistence & Privilege
The skill is not always-enabled and does not request persistent system-wide privileges. It writes output artifacts to a workspace directory (~/.openclaw/workspace/cad-output by default) and manages its own temp files. It does not modify other skills or global agent config.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install build123d-cad
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /build123d-cad 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.2
- 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.
v1.1.1
- Internal code changes to scripts: cad_generate.py, cad_measure.py, cad_section.py, cad_validate.py, and helpers.py. - No changes to user-facing documentation or commands. - Version remains at 1.0.0 in documentation. - Likely minor improvements or bug fixes to CAD scripting workflow.
v1.1.0
- Adds validation command: `cad_validate.py` for assembly interference, clearance, and moving-part collision checks. - Updated documentation to cover validation modes (static, clearance, sweep, full) and expected script structure for assemblies. - Improved workflow: recommend running validation before file export for multi-part assemblies. - Minor README and SKILL.md updates for clarity and new functionality.
v1.0.0
Initial release of build123d-cad skill. - Enables parametric 3D CAD modeling using Python scripts and build123d. - Supports exporting solids as STEP, STL, or SVG files. - Provides measurement of model geometry and mass. - Generates 2D cross-section SVGs from 3D models. - Includes a build123d API reference/cheatsheet command. - Enforces reusable, parameterized CAD scripting practices.
元数据
Slug build123d-cad
版本 1.1.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 4
常见问题

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... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 424 次。

如何安装 Build123d Cad?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install build123d-cad」即可一键安装,无需额外配置。

Build123d Cad 是免费的吗?

是的,Build123d Cad 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Build123d Cad 支持哪些平台?

Build123d Cad 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Build123d Cad?

由 wngfra(@wngfra)开发并维护,当前版本 v1.1.2。

💬 留言讨论