Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.

CAiD

An agent-friendly CAD engine built directly on OpenCASCADE through the cadquery-ocp bindings. CAiD combines a validated stateless geometry API with a persistent semantic document layer for parametric parts and assemblies.

CAiD talks directly to OCCT through OCP — no CadQuery dependency and no FreeCAD application/runtime dependency.

Install

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install caid

CAiD 0.2 requires Python 3.12 or newer.

The cadquery-ocp wheel is pulled in automatically. Sketch constraint solving is optional:

pip install "caid[parametric]"

The current default sketch adapter uses PlaneGCS and therefore requires Python 3.12+.

Quick Example

import caid

box = caid.box(40, 30, 10)
print(box.ok)
print(box.volume_after)  # 12000.0

with_hole = caid.add_hole(box, radius=2.7, depth=10)
filleted = caid.fillet(with_hole, radius=1.5, edge_selector=">Z")
caid.to_step(filleted, "bracket.step")

Developer semantic proof programs

The executable examples/ directory is intentionally not the product gallery. These are compact engine-level programs for developers reviewing CAiD's semantics and failure behavior.

Program What it proves
persistent_associativity.py A persistent top-face reference, datum, and attached sketch follow a body-height revision while retaining the same semantic UUIDs.
fail_closed_topology.py When a shell removes a referenced design face, downstream geometry fails with lost provenance instead of silently rebinding to another face.
four_bar_ondsel.py A closed kinematic loop explicitly escalates from the deterministic tree solver to the optional nonlinear Ondsel backend and is verified after solving.

For recognizable engineering examples — mounting brackets, electronics enclosures, manufacturing plates, assemblies, and checked AI revisions — see the caid-mcp engineering showcase. That MCP surface is the primary product interface for headless AI CAD.

Architecture

AI / application clients
        ↓
CAiD semantic documents
        ├── CaidDocument        parametric parts
        └── AssemblyDocument    assemblies / mechanisms
        ↓
feature + reference semantics
        ├── parameters / configurations / history
        ├── persistent face & edge provenance
        ├── sketch definitions
        └── mate connectors / joints
        ↓
replaceable numerical services
        ├── SketchSolverProtocol
        │      └── PlaneGCSSolver (default adapter)
        └── AssemblySolverProtocol
               └── TreeAssemblySolver
        ↓
OCP / OpenCASCADE

The semantic document is the source of truth. B-Reps, solver runtime IDs, and numerical backend state are rebuild products or runtime infrastructure.

Solver boundaries

CAiD deliberately does not make third-party solver data models part of its file format.

For sketches:

SketchDefinition
      ↓ stable CAiD entity/constraint IDs
SketchSolverProtocol
      ↓
PlaneGCSSolver or another backend
      ↓ stable CAiD-ID SketchSolveReport

SketchDefinition owns entities, constraints, expressions, contours, stable IDs, and persistence. PlaneGCSSolver owns only the numerical solve. A custom backend can be injected directly:

report = definition.solve(parameters, solver=my_solver)

or for an entire document rebuild:

doc = caid.CaidDocument("part", sketch_solver=my_solver)

The runtime solver is intentionally not serialized and does not affect the document fingerprint. A saved .caid.json model is therefore not a PlaneGCS document; it is a CAiD document that can be solved by any compatible SketchSolverProtocol implementation.

Assemblies follow the same principle through AssemblySolverProtocol. The built-in tree solver handles deterministic acyclic joint graphs and explicitly escalates closed loops instead of inventing a traversal-order solution.

This architecture means CAiD may use engines that originated in or are maintained by the FreeCAD ecosystem without becoming “FreeCAD without a GUI.” FreeCAD is useful prior art; CAiD's document model, feature graph, topology semantics, assembly model, and persistence remain independent.

Key Concepts

ForgeResult

Every stateless geometry operation returns a ForgeResult instead of silently trusting an OCCT operation:

result = caid.box(10, 20, 30)
result.ok
result.shape
result.valid
result.volume_before
result.volume_after
result.surface_area
result.diagnostics
result.unwrap()

Stateless geometry API

Pass shapes in and get validated results out:

a = caid.box(10, 10, 10)
b = caid.cylinder(3, 20)
cut = caid.boolean_cut(a, b)

Parametric part documents

CaidDocument provides persistent semantic modeling above the stateless geometry layer. Current capabilities include:

  • named parameters and safe expressions;
  • stable-ID general sketches and constraints;
  • arbitrary reference-plane placement;
  • extrude, cut-extrude, revolve, holes;
  • persistent face/edge references with OCCT history + TNaming support;
  • fillet, chamfer, shell, draft, mirror;
  • linear and circular patterns;
  • named configurations;
  • dependency-safe feature history, suppression, and rollback;
  • semantic save/open and deterministic fingerprints.

Example:

import caid

sketch = caid.SketchDefinition("Profile")
p0 = sketch.add_point(0, 0, fixed=True)
p1 = sketch.add_point("Width", 0)
p2 = sketch.add_point("Width", "Height")
p3 = sketch.add_point(0, "Height")
l0 = sketch.add_line(p0, p1)
l1 = sketch.add_line(p1, p2)
l2 = sketch.add_line(p2, p3)
l3 = sketch.add_line(p3, p0)
sketch.constrain("horizontal", l0)
sketch.constrain("horizontal", l2)
sketch.constrain("vertical", l1)
sketch.constrain("vertical", l3)
sketch.constrain("distance", p0, p1, value="Width")
sketch.constrain("distance", p1, p2, value="Height")
sketch.add_contour(l0, l1, l2, l3)

doc = caid.CaidDocument("bracket")
doc.add_parameter("Width", 40)
doc.add_parameter("Height", 30)
doc.add_parameter("Depth", 10)
profile = doc.add_feature(caid.GeneralSketchFeature("Profile", sketch))
body = doc.add_feature(caid.ExtrudeFeature("Body", profile.id, "Depth"))
assert doc.rebuild().ok

doc.set_parameter("Width", 60)
assert doc.rebuild().ok
doc.save("bracket.caid.json")

Persistent topology

Persistent geometry references use stable CAiD UUIDs and feature-owned design provenance. Current operator history is checked before TNaming so a prior binding cannot hide a later face/edge split. Ambiguous or lost design entities fail closed rather than silently selecting a geometrically convenient replacement.

Assemblies

AssemblyDocument embeds reusable semantic part definitions and stores stable component instances, rigid poses, mate connectors, grounded state, typed joints, BOM data, and interference checks.

The built-in TreeAssemblySolver supports fixed, revolute, slider, and cylindrical joints on acyclic graphs. Floating components report underconstrained; closed joint loops report needs_nonlinear_solver so a stronger backend can be introduced through the same solver protocol.

Output Directory

By default, exports go to ~/cadquery-output/ for backward compatibility.

Development

pip install -e ".[dev,parametric]"
pytest -q

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caid-0.2.0.tar.gz (159.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

caid-0.2.0-py3-none-any.whl (137.3 kB view details)

Uploaded Python 3

File details

Details for the file caid-0.2.0.tar.gz.

File metadata

  • Download URL: caid-0.2.0.tar.gz
  • Upload date:
  • Size: 159.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for caid-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4ac7b81ca8335aa960ca4e72b558a391c22533cb54d44512a44ab31851721c77
MD5 3275994de5c65afa8b03a29bbe7d4c94
BLAKE2b-256 6c5097c69892ff3a7b980c1c9b0ea1eb2a4185ad8e52a23c2641ee80274b3fa6

See more details on using hashes here.

Provenance

The following attestation bundles were made for caid-0.2.0.tar.gz:

Publisher: publish.yml on dreliq9/CAiD

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file caid-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: caid-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 137.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for caid-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b3d9b26b458322b4349c0291ea09213e07ce6622c13813e63b0d085eec59dd7
MD5 bd86e15002d7c6651fb0bff8f6aed0bb
BLAKE2b-256 c68f2d66a47e422d76fcd520b796be53d12b341ee9a17dc54e7baaadfb8c92e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for caid-0.2.0-py3-none-any.whl:

Publisher: publish.yml on dreliq9/CAiD

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 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