跳到主要内容

GraphSession

类型:
领域: Graph、序列化与重放
推荐导入: from cadflow import GraphSession

签名

class GraphSession(graph_id: 'Optional[str]' = None) -> 'None'

功能说明

GraphSession 是 CadFlow Graph、序列化与重放领域的公共类。

原始 API 说明

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())

参数

名称类型必需默认值源码说明
graph_id'Optional[str]'None源码 Docstring 未单独说明。

返回值

类型: 'None'

源码 Docstring 未声明更多返回语义。

异常

源码 Docstring 未声明更窄的异常契约。类型、数值、所有权、路径或后端状态无效时,仍可能抛出相应公共异常。

公共成员

成员类型签名说明
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'见成员签名。
stopmethod(self) -> 'None'见成员签名。
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.

行为与约束

  • 以下契约由当前公共运行时签名生成;所有权与工作流限制见对应领域说明。

导入检查

from cadflow import GraphSession

相关内容