Skip to main content

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

NameTypeRequiredDefaultSource description
graph_id'Optional[str]'noNoneNot 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

MemberKindSignatureDescription
capture_resultmethod(self, *, value: 'Any') -> 'Any'Capture graph nodes directly represented by value as results.
captured_valuesproperty-Return values explicitly marked for final artifact export.
clear_resultsmethod(self) -> 'None'Clear explicit result nodes and restore leaf fallback on export.
has_explicit_resultsproperty-Whether capture_result has been called for this session.
require_tolerancemethod(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_idsproperty-Return the explicitly captured model result node ids.
startmethod(self) -> 'None'See the member signature.
stopmethod(self) -> 'None'See the member signature.
validate_graph_ownershipmethod(self, value: 'Any') -> 'None'Reject values carrying lineage from a different graph.
validate_tolerancesmethod(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

See also