Files
make-cad/docs/skill/references/docs/api/GraphSession.md
T
NiJingzhe 8971279494 feat: the geometry engine is C++ on OpenCASCADE, one package, prebuilt wheels
The modeling API (shapes, operators, sketches, products, queries, the reactive graph) is implemented in
C++20 on OpenCASCADE (src/cpp) and ships inside the wheel as simplecadapi._cpp.  The Python layers that stay
Python (runtime, build, artifacts, editor, inspect, exporter, translators, scene) run on it unchanged; the
previous Python test suite passes on the new engine.

Layout: src/cpp and src/simplecadapi side by side, one distribution built by scikit-build-core.
simplecadapi.core, .operators.*, .ql, .std.* and the other legacy modules are real forwarding modules; the
Python adapter layer is simplecadapi/_glue.  OCP is no longer a dependency and nothing imports it.

Release: .github/workflows/release.yml builds wheels for Linux x86_64 and aarch64, macOS arm64 and Windows
x86_64 (Python 3.10-3.13) against one static OCCT, runs the test suite on the Linux wheels and publishes to
GitHub and PyPI; ci.yml caches the static OCCT for the test jobs.

Errors: every message the library writes is English; the tag-validation and semantic-query errors render in
full with possible causes and fixes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 02:55:35 +08:00

1.3 KiB

GraphSession

Class Definition

class GraphSession()

Source: recording/graph.py

Import Surface

  • top-level: from simplecadapi import GraphSession

Description

Context manager that records CAD operations into a DAG.

with GraphSession() as session: n1 = record_operation( "make_line_redge", {"start": (0, 0, 0), "end": (1, 0, 0)} ) n2 = record_operation( "make_line_redge", {"start": (1, 0, 0), "end": (1, 1, 0)} ) record_operation( "make_wire_from_edges_rwire", {"edge_count": 2}, inputs=[n1, n2] )

Access the graph after the session

print(session.graph.topological_order())

Parameters

graph_id

  • Description: Id of the recorded graph (random when omitted).

allow_external_definitions

  • Description: Let built Part/Assembly values that carry their own definition enter as reference_definition nodes instead of being rejected.

namespace

  • Description: Prefix for every node and object id this session allocates, as in OperationGraph(namespace=...).

shared_lineage

  • Description: Accept values recorded by other sessions with the same graph_id by adopting their nodes, as in OperationGraph.adopt. Notebook cell sessions use this; every other session only accepts nodes its own graph owns.