GraphSession
Kind: Class
Domain: Graph, serialization, and replay
Canonical import: from cadflow import GraphSession
Signature
class GraphSession(graph_id: 'Optional[str]' = None) -> 'None'
Description
Context manager that records CAD operations into a DAG.
Context manager that records CAD operations into a DAG.
Usage::
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
| Name | Type | Required | Default | Source description |
|---|---|---|---|---|
graph_id | 'Optional[str]' | no | None | Not explicitly described in the source docstring. |
Returns
Type: 'None'
The source docstring does not declare additional return semantics.
Errors
The source docstring does not declare a narrower exception contract. Invalid types, values, ownership, paths, or backend state may still raise the corresponding public error.
Public members
| Member | Kind | Signature | Description |
|---|---|---|---|
capture_result | method | (self, *, value: 'Any') -> 'Any' | Capture graph nodes directly represented by value as results. |
captured_values | property | - | Return values explicitly marked for final artifact export. |
clear_results | method | (self) -> 'None' | Clear explicit result nodes and restore leaf fallback on export. |
has_explicit_results | property | - | Whether capture_result has been called for this session. |
require_tolerance | method | (self, value: 'ScalarLike', tolerance: 'ToleranceLike', *, method: 'ToleranceMethod' = 'worst_case', name: 'str | None' = None, requirement_id: 'str | None' = None, tolerance_unit: 'UnitLike | None' = None) -> 'ToleranceRequirement' | Declare a persisted Length or Angle manufacturing requirement. |
result_node_ids | property | - | Return the explicitly captured model result node ids. |
start | method | (self) -> 'None' | See the member signature. |
stop | method | (self) -> 'None' | See the member signature. |
validate_graph_ownership | method | (self, value: 'Any') -> 'None' | Reject values carrying lineage from a different graph. |
validate_tolerances | method | (self, *, raise_on_failure: 'bool' = False) -> 'ToleranceReport' | Validate every declared dimension-chain requirement. |
Behavior and constraints
- The contract below is generated from the current public runtime signature. Check domain notes for ownership and workflow constraints.
Import check
from cadflow import GraphSession