Skip to main content

cadgen

STEP-first CAD artifact generation runtime for CAD agent skills, built on build123d and OCCT.

The package boundary is intentionally narrow: it owns artifact generation, validation, selector/topology extraction, mesh settings, source hashing, and the cadgen-step-artifact CLI. It also includes small generated-script helpers such as cadgen.assembly.AssemblyHelper, which wraps native build123d labels, joints, and compounds without owning skill-specific UX. Prompts, viewer UI, and snapshot job orchestration stay in their owning skills.

cadgen is developed in earthtojake/text-to-cad and was previously named cadpy inside that repository.

Public API

The supported import surface is the root cadgen exports plus the top-level cadgen.* modules:

  • Generator-script helpers: root exports (AssemblyHelper, MateRelation, MateTarget, label_text, label_shape, target, ensure_step_glb_artifact, validate_step_glb_artifact), cadgen.assembly, and cadgen.step_scene (import_step, load_step_scene, located_shape, occurrence_selector_id, scene_occurrence_shape).
  • Generator-script helpers (2D): cadgen.sources (load_source_module) and cadgen.flatten (planar-face projection/unfold, contour emission, kerf offsetting) for .dxf.py drawing generators.
  • Skill CLI surface: cadgen.generation (generate_step_targets, generate_dxf_targets, targets_include_output_pairs), cadgen.catalog, cadgen.metadata, cadgen.analysis, cadgen.lookup, cadgen.cad_ref_syntax, cadgen.selector_types, cadgen.reporting, cadgen.cli_logging, cadgen.render, cadgen.step_artifacts, cadgen.step_targets, cadgen.step_export, cadgen.drawing_checks (DXF drawing validation), and cadgen.drawing_render (DXF render payload + SVG snapshots).
  • Process entry points: cadgen-step-artifact, python -m cadgen.step_artifact_cli, python -m cadgen.step_export_target, and python -m cadgen.dxf_artifact.

Everything under cadgen._internal is private implementation (the STEP scene, generation, GLB/topology, and export engines live there) with no import stability between releases; cadgen.generation and cadgen.step_scene are thin facades over those engines that re-export only the supported names.

Install

Released versions are published to PyPI by the repository's Release workflow; the package version always matches the CAD plugin release version:

python -m pip install cadgen

Production skill bundles pin the exact release version in their requirements.txt (for example cadgen==0.4.0) and keep a vendored copy of this package as an offline fallback:

python -m pip install ./scripts/packages/cadgen

Local Development

Install it editable into the repo CAD runtime when working on the source package directly:

./.venv/bin/python -m pip install -e packages/cadgen

After that, changes under packages/cadgen/src/cadgen are immediately visible to local source checkouts that import the package directly.

On develop, the CAD skill and root Viewer point at this package through the development symlinks skills/cad/scripts/packages/cadgen and viewer/packages/cadgen. Keep those links intact with scripts/dev/setup-symlinks.sh --check.

Production Bundling

Build a wheel and install it into each skill's bundled Python environment during packaging:

./.venv/bin/python -m build packages/cadgen
python -m pip install packages/cadgen/dist/cadgen-*.whl

The CAD and cad-viewer skills should depend on the package artifact they bundle, not on skills/cad or the repository root. Production packaging vendors installable packages under skills/cad/scripts/packages/cadgen and skills/cad-viewer/scripts/viewer/packages/cadgen; production packaging can also set VIEWER_CAD_PYTHON to a skill-local Python runtime with this package installed. Production skill bundles install cadgen==<release version> from PyPI first and fall back to the vendored copy when offline.

Metadata

Release files for cadgen 0.4.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cadgen 0.4.25
File Size Uploaded
cadgen-0.4.25.tar.gz 281.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cadgen 0.4.25
File Interpreter ABI Platform
cadgen-0.4.25-py3-none-any.whl Python 3 none any Details

Total release size: 603.2 kB

Release files / cadgen-0.4.25.tar.gz

Download URL cadgen-0.4.25.tar.gz
Size 281.9 kB
Tags Source
SHA-256 checksum
How to use checksums
13ed1814f7844ff094a49da8692a00765eeaed6c6c6ee591a80d7eb24ad1f6bd
BLAKE2b-256 checksum
How to use checksums
e1ede28e9e62b656bec60a198dfb431f41f67deec001d8cd480158bb8aa7ba71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release files / cadgen-0.4.25-py3-none-any.whl

Download URL cadgen-0.4.25-py3-none-any.whl
Size 321.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f29f7e715a0381dd8f43cf04b953a298ff8371b43abf5d8d5bea4e8a3a1d23e
BLAKE2b-256 checksum
How to use checksums
65ae3c1ec2e15023412e5c0e5b9c562442992b1398806a921778f7f8d53e6a6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.28

2 release files

0.4.27

2 release files

0.4.26

2 release files

This release

0.4.25 This release

2 release files

0.4.24

2 release files

0.4.23

2 release files

0.4.22

2 release files

0.4.21

2 release files

0.4.20

2 release files

0.4.19

2 release files

0.4.18

2 release files

0.4.17

2 release files

0.4.16

2 release files

0.4.15

2 release files

0.4.14

2 release files

0.4.13

2 release files

0.4.12

2 release files

0.4.11

2 release files

0.4.10

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page