Skip to main content

API reference

CadFlow exposes two complementary public styles. The session-oriented API uses Model and Shape for direct native geometry work. The declarative API records richer operations, semantics, products, and exchange artifacts for inspection and replay. Both are supported; choose the smallest surface that preserves the state your workflow needs.

Choose an entry point

NeedStart withResult
Build and inspect native geometry interactivelyModelSession-owned Shape values
Execute a known native batchGraphOrdered string results across the stable C ABI
Record and replay a structured design workflow@modelModelResult, Model JSON, and session JSON
Construct constrained 2D profilesSketch APIImmutable sketch state, solve diagnostics, and native profiles
Organize reusable productsAssembly APIParts, occurrences, connectors, constraints, and reports
Inspect STEP/BREP evidenceInspection APIStructured topology, measurements, comparisons, sections, and views
Compile portable render artifactsScene APIValidated Scene packages and GLB resources
Describe static thin geometryFlexible APIDeterministic sampled panel meshes and exports
Describe reduced connection behaviorPhysical APIValidated connection layers and response batches
Package distributed face contactSimulation APISolver-independent contact evidence and handoff packages

Reference layers

This reference is intentionally split into three layers:

  1. Concept and contract pages explain ownership, units, mutation, error behavior, and recommended workflows.
  2. Domain catalogs list every public symbol in one subsystem.
  3. Generated symbol pages preserve the runtime signature, parameters, return annotation, aliases, fields, and public members for each symbol.

Use all API symbols when you know a name, or open a domain catalog when you know the subsystem.

Core runtime

PageCovers
ModelSession lifecycle, construction groups, preflight, and dynamic operations
ShapeOwnership, measurements, validation, meshing, and export
Sessions and framesNativeSession, opaque handles, CoordinateFrame, and Workplane
Feedback and previewDiagnostics, reports, preview buffers, and GLB conversion

Modeling and execution

PageCovers
Creation and importPrimitives, profiles, curves, surfaces, and external geometry
Features and transformsExtrude, revolve, sweep, booleans, local features, and copies
Topology, query, and exchangeSubshapes, selection, measurements, validation, STEP/STL/BREP
Native GraphNode references, supported batches, execution, and result decoding
Recording and replay@model, GraphSession, Model JSON, strict replay, and artifacts
Expressions, units, and tolerancesSymbolic values, dimensions, conversions, and tolerance analysis

Contract conventions

Read API conventions before integrating CadFlow into a long-lived application. Read errors and diagnostics before building automated recovery or agent feedback.

Important defaults:

  • Public imports come from cadflow or the documented public submodules. Do not import cadflow._engine.
  • Coordinates and angles are ordinary Python numbers; a function accepting a unit-bearing value says so explicitly.
  • Shape values cannot cross Model sessions.
  • Product, sketch, physical, and simulation data are generally immutable or functionally updated; assign returned replacements.
  • Paths may write artifacts. A successful call does not replace downstream file, schema, or geometry validation.

Completeness and version

The generated reference currently covers 518 unique public symbols, including 414 of 414 top-level exports and explicit exports from 28 public module surfaces. It is generated from CadFlow 0.1.0 and can be checked against the runtime with:

PYTHONPATH=../CadFlow/python python scripts/generate_api_reference.py --check

CadFlow is Alpha. Pin the package version, retain artifact metadata, and review compatibility and migration before upgrading.