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_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' | 见成员签名。 |
stop | method | (self) -> 'None' | 见成员签名。 |
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. |
行为与约束
- 以下契约由当前公共运行时签名生成;所有权与工作流限制见对应领域说明。
导入检查
from cadflow import GraphSession