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.27

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.27
File Size Uploaded
cadgen-0.4.27.tar.gz 287.2 kB Details

Built distribution (wheel)

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

Total release size: 614.7 kB

Release files / cadgen-0.4.27.tar.gz

Download URL cadgen-0.4.27.tar.gz
Size 287.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ba7adda69880aeb80778224a5ea772551273b8d958226aa98295006ea2bda727
BLAKE2b-256 checksum
How to use checksums
7c332d9183080a2574cc9e8368fa9538f9e4ddb0171c4d9ffc2c8d005211ffb6
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 25, 2026.

Transparency log

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

Download URL cadgen-0.4.27-py3-none-any.whl
Size 327.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e61c205140b612a796d504a406f2e456d5d64e125cfe856f563439694b505433
BLAKE2b-256 checksum
How to use checksums
c55c9b6e8df19d2a985b1940dae5a75f0936ee7208ddd9c3b4903fb2fc8fc571
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 25, 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

This release

0.4.27 This release

2 release files

0.4.26

2 release files

0.4.25

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