← Back to Skills Marketplace
wngfra

Build123d Cad

by wngfra · GitHub ↗ · v1.1.2 · MIT-0
cross-platform ⚠ suspicious
424
Downloads
1
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install build123d-cad
Description
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...
README (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.
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install build123d-cad
  3. After installation, invoke the skill by name or use /build123d-cad
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug build123d-cad
Version 1.1.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is 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... It is an AI Agent Skill for Claude Code / OpenClaw, with 424 downloads so far.

How do I install Build123d Cad?

Run "/install build123d-cad" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Build123d Cad free?

Yes, Build123d Cad is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Build123d Cad support?

Build123d Cad is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Build123d Cad?

It is built and maintained by wngfra (@wngfra); the current version is v1.1.2.

💬 Comments