libcascade
API ReferenceModelingDataTKBRepBRepGraph

BRepGraph

OCCT package BRepGraph: BRepGraph, BRepGraph_Cache, BRepGraph_CacheDerivedState, BRepGraph_CacheIterator, and 179 more bound classes.

BRepGraph

Topology-geometry graph over TopoDS / BRep.
Stores B-Rep topology as flat entity vectors (incidence-table model) with integer cross-references, enabling cache-friendly traversal, relation-table parent navigation, and parallel face-level geometry extraction.
Key design concepts:

  • NodeId (Kind + Index): lightweight typed address into per-kind vectors.
  • UID (Kind + Counter): persistent identity surviving compaction/reorder.
  • RepId (Kind + Index): separate geometry/mesh addressing (Surface, Curve3D, Curve2D, Triangulation, Polygon) decoupled from topology nodes.
  • CoEdge: half-edge entity owning PCurve data for each edge-face binding; seam edges use paired CoEdges with opposite Orientation (Parasolid convention).
  • Lifecycle: Shapes().Add() populates from TopoDS_Shape; Editor() is the single mutation entry point for both structural creation/removal (Add*, Remove*, Append*) and field-level RAII-scoped mutation (Mut*()) with automatic cache invalidation and upward SubtreeGen propagation.
    Per-occurrence data (orientation, location) lives on incidence refs. Definition types are aliases to BRepGraphInc entity structs.
    Grouped View API
    Related methods are grouped behind lightweight view objects. Include the corresponding header (e.g. BRepGraph_TopoView.hxx) to use.
    Thread safety
    Const query methods are safe for concurrent reads. Concurrent reads during active mutation still require external synchronization. Deferred invalidation (BRepGraph_DeferredScope) batches SubtreeGen propagation; concurrent Editor().Mut*() calls during deferred mode still require external serialization. Shapes().Add() is internally parallel when requested.
    UID persistence
    UIDs use monotonic counters (not vector indices), persisting across Compact() and node removal. Only BRepGraph::Clear() resets counters (new generation). See BRepGraph_UID.hxx for the serialization contract.
    Extension model
    Extend via BRepGraph_Layer (persistent metadata / observers) or BRepGraph_CacheRegistry (typed algorithm-computed transient cache services). Direct storage extension is not supported.
    ID systems
    Four ID types with different stability guarantees:
  • NodeId (Kind + per-kind Index): fast graph-local address. NOT stable across Compact(). Use for in-graph traversal and short-lived algorithm temporaries.
  • UID (Kind + monotonic Counter): persistent identity surviving Compact() and node removal. Use for cross-session storage, history tracking, and external references.
  • RefId (Kind + per-kind Index): same stability as NodeId, but addresses reference entries (Shell->Solid binding, Face->Shell binding, CoEdge->Wire binding) rather than defs.
  • RepId (Kind + per-kind Index): addresses owner-scoped geometry/mesh representation slots (Surface, Curve3D, Curve2D, Triangulation, Polygon).
    Iterator guide
    Choose the iterator that matches your traversal need:
  • BRepGraph_Iterator<NodeType>: flat sequential scan of ALL definitions of one kind (e.g. every FaceDef, skipping removed). Use for bulk per-kind algorithms.
  • BRepGraph_DefsIterator / BRepGraph_RefsIterator: single-level typed children of one parent (e.g. active shells of one solid, coedges of one wire). Zero allocation. Use when you have a specific parent and need its direct children.
  • BRepGraph_ChildExplorer: depth-first downward walk from a root with accumulated location/orientation per step. Use when visiting descendants across multiple levels or when the global transform matters. Supports Recursive and DirectChildren modes.
  • BRepGraph_ParentExplorer: upward walk via relation tables from a starting node. Use when tracing which shells/solids/compounds contain a given face or edge.
  • BRepGraph_RelatedIterator: single-level semantic neighbors (adjacent faces, boundary edges, incident vertices). No structural descent; no location accumulation.

Constructors(1)

Instance methods(15)

  • Clear(): void

    Reset the graph to an empty state. Increments generation and regenerates the graph GUID.

  • IsEmpty(): boolean

    Return true when the graph contains no topology definitions.

  • Verify relation consistency against entity / reference-entry tables. Intended for debug builds and regression tests of incremental mutation paths.

    Returns

    true when every stored relation matches its endpoints.

  • Return root product identifiers (products not referenced by any active occurrence). Maintained incrementally by Editor/EditorView mutations. Returns empty vector if the graph has not been built.

  • Return the current allocator.

  • IsValid(): boolean

    Return true when this wrapper references graph data.

  • IsNull(): boolean

    Return true when this wrapper does not reference graph data.

  • Access topology definitions, representation access, adjacency queries, raw Product/Occurrence definition storage, and assembly classification.

  • Access unique identifiers.

  • Access reference entries and their UIDs.

  • Access cached and fresh shape reconstruction.

  • Access programmatic graph construction and mutation.

  • Access mesh data with explicit Cache()/Persistent() sub-views and Editor() for cache mutations. Persistent rep creation lives on Editor().Edges(), Editor().CoEdges(), Editor().Faces() (since reps back the topology defs).

    Returns

    read-only mesh view

  • Access registered graph layers.

    Returns

    layer registry for managing attribute layers

  • Access registered graph cache services.

    Returns

    cache registry for managing typed transient cache services

BRepGraph_Cache

Lightweight owner-bound base for transient graph cache services.
A cache service stores typed, recomputable, graph-local data such as bounding boxes, UV bounds, or display-resolution results. The registry owns only service identity and lifetime binding; concrete caches own their own typed storage and validate freshness lazily via graph generation counters.

Static methods(2)

Instance methods(5)

BRepGraph_CacheDerivedState

Cache for derived edge, wire, and shell properties.
Each query is independent and caches only its own result. Callers request specific values (IsDegenerated, SameParameter, etc.) and the cache computes + stores only what is needed.

Constructors(1)

Static methods(6)

  • Returns the unique cache service GUID.

  • ComputeEdgeProperties(theGraph: BRepGraph, theEdge: BRepGraph_EdgeId, theIsDegenerated?: boolean, theIsClosed?: boolean): { returnValue: boolean; theIsDegenerated: boolean; theIsClosed: boolean }

    Compute edge-own derived state (Status, IsClosed). SameRange/SameParameter are per-CoEdge - use the per-CoEdge cache directly.

    Parameters (4)
    • theGraph
      source graph
    • theEdge
      edge definition identifier
    • theIsDegenerated
      true if edge is degenerate
    • theIsClosed
      true if edge is closed
    Returns

    A result object with fields:

    • returnValue: true if computation succeeded
    • theIsDegenerated: true if edge is degenerate
    • theIsClosed: true if edge is closed
  • ComputeShellIsClosed(theGraph: BRepGraph, theShell: BRepGraph_ShellId): boolean

    Compute shell closure directly from a BRepGraph without caching.

    Parameters (2)
    • theGraph
      source graph
    • theShell
      shell definition identifier
    Returns

    true if the shell is closed

  • ComputeWireIsClosed(theGraph: BRepGraph, theWire: BRepGraph_WireId): boolean

    Compute wire closure directly from a BRepGraph without caching.

    Parameters (2)
    • theGraph
      source graph
    • theWire
      wire definition identifier
    Returns

    true if the wire is closed

  • get_type_name(): string

Instance methods(12)

  • Returns the unique cache service GUID.

  • Returns the cache service display name.

  • Clear(): void

    Clears all cached entries.

  • Copy fresh, remappable derived-state entries into the target graph.

    Parameters (1)
    • theCopy
  • IsDegenerated(theEdge: BRepGraph_EdgeId): boolean

    Test if an edge is degenerate (no 3D curve and vertex collapse). Computes and caches only Status - does NOT compute SameParameter/SameRange.

    Parameters (1)
    • theEdge
      edge definition identifier
    Returns

    true if the edge is degenerate

  • SameParameter(theCoEdge: BRepGraph_CoEdgeId): boolean

    Test if a single coedge has SameParameter.

    Parameters (1)
    • theCoEdge
      coedge definition identifier
    Returns

    true if the coedge has SameParameter

  • SameRange(theCoEdge: BRepGraph_CoEdgeId): boolean

    Test if a single coedge has SameRange.

    Parameters (1)
    • theCoEdge
      coedge definition identifier
    Returns

    true if the coedge has SameRange

  • IsClosed(theEdge: BRepGraph_EdgeId): boolean

    Test if an edge is closed (start vertex == end vertex). Computes and caches only IsClosed.

    Parameters (1)
    • theEdge
      edge definition identifier
    Returns

    true if the edge is closed

  • GetWireIsClosed(theWire: BRepGraph_WireId, theClosed?: boolean): { returnValue: boolean; theClosed: boolean }

    Return wire closure, computing and storing a fresh entry.

    Parameters (2)
    • theWire
      wire definition identifier
    • theClosed
      filled with the fresh derived value
    Returns

    A result object with fields:

    • returnValue: true if computation succeeded
    • theClosed: filled with the fresh derived value
  • SetWireIsClosed(theWire: BRepGraph_WireId, theClosed: boolean): void

    Store a pre-computed wire closure value.

    Parameters (2)
    • theWire
      wire definition identifier
    • theClosed
      pre-computed closure value
  • IsShellClosed(theShell: BRepGraph_ShellId): boolean

    Test if a shell is closed.

    Parameters (1)
    • theShell
      shell definition identifier
    Returns

    true if the shell is closed

BRepGraph_CacheIterator

Iterator over registered cache families in a BRepGraph_CacheRegistry.
Supports OCCT More()/Next()/Value() pattern and STL range-for via begin()/end().

Constructors(1)

Instance methods(6)

BRepGraph_CacheRegistry

GUID-keyed runtime registry of graph cache services.
Stores registered cache services in a stable slot array for O(1) slot access and a GUID-to-slot map for lookup by stable public identity. Cache services own their typed transient data; this registry only manages identity and owner binding.

Constructors(1)

Instance methods(12)

  • RegisterCache(theCache: BRepGraph_Cache): number

    Register a cache service. Replaces an existing cache with the same GUID.

    Parameters (1)
    • theCache
      cache service
    Returns

    graph-local slot index

  • Register(theCache: BRepGraph_Cache): number

    Register a cache service. Short form used by graph-local cache operations.

    Parameters (1)
    • theCache
      cache service
    Returns

    graph-local slot index

  • Remove a cache service by GUID.

    Parameters (1)
    • theGUID
      cache identity
  • Find a cache service by GUID.

    Parameters (1)
    • theGUID
      cache identity
    Returns

    cache service, or null handle if not found

  • FindSlot(theGUID: Standard_GUID, theSlot: number): { returnValue: boolean; theSlot: number }

    Return current graph-local slot for a GUID.

    Parameters (2)
    • theGUID
      cache family identity
    • theSlot
      graph-local slot index
    Returns

    A result object with fields:

    • returnValue: true if the cache service is registered
    • theSlot: graph-local slot index
  • FindSlot(theCache: BRepGraph_Cache, theSlot: number): { returnValue: boolean; theSlot: number }

    Return current graph-local slot for a cache service.

    Parameters (2)
    • theCache
      cache service
    • theSlot
      graph-local slot index
    Returns

    A result object with fields:

    • returnValue: true if the cache service is registered
    • theSlot: graph-local slot index
  • Cache(theSlot: number): BRepGraph_Cache

    Return cache service by graph-local slot, or null handle if the slot is out of range.

    Parameters (1)
    • theSlot
      graph-local cache slot
  • NbCaches(): number

    Number of registered cache services.

  • ClearAll(): void

    Clear data in all registered cache services.

  • CopyFreshCachesTo(theTargetGraph: BRepGraph, theItemRemap: any, theMode: BRepGraph_CopyRemap_Mode): void

    Ask registered cache services to copy fresh, remappable data into the target graph.

    Parameters (3)
    • theTargetGraph
    • theItemRemap
    • theMode
  • CopyFreshCachesTo(theTargetGraph: BRepGraph, theMappingKind: BRepGraph_CopyRemap_MappingKind, theMode: BRepGraph_CopyRemap_Mode): void

    Ask registered cache services to copy fresh data using identity mapping.

    Parameters (3)
    • theTargetGraph
    • theMappingKind
    • theMode
  • Clear(): void

    Unregister all cache services.

BRepGraph_ChildExplorer

Stack-based lazy downward hierarchy walker for BRepGraph with inline location/orientation accumulation.
Walks the graph hierarchy from a root node down to entities of a target kind, yielding one occurrence at a time via a depth-first stack. Location and orientation are composed incrementally during the walk, making Current().Location and Current().Orientation O(1) per call.
The traversal follows the actual graph structure transparently - every node kind is visited as a distinct entity (no hidden collapses): Compound -> children, CompSolid -> Solids, Solid -> Shells, Shell -> Faces, Face -> Wires (+direct Vertices), Wire -> CoEdges, CoEdge -> Edge, Edge -> Vertices, Product -> Occurrences, Occurrence -> Product/topology-root.
Unlike flat definition traversal by typed ids, BRepGraph_ChildExplorer visits each occurrence. If Edge[5] is reachable through Face[0] and Face[1], it is visited twice with different accumulated transforms.
Traversal modes

  • Recursive: depth-first walk through the full subgraph. Without target kind, all descendant nodes are emitted. With target kind, only matching nodes are emitted but intermediate levels are traversed to reach them.
  • DirectChildren: yields only the immediate children of the root. No descent into grandchildren. With target kind, only children matching the kind are returned.

Constructors(12)

  • Explore all descendants of the root node using recursive traversal.

    Parameters (2)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theConfig: BRepGraph_ChildExplorer_Config): BRepGraph_ChildExplorer

    Preferred long-term constructor: all tuning knobs in Config.

    Parameters (3)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
    • theConfig
      traversal configuration (mode, target kind, avoid kind, etc.)
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theMode: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore descendants of the root node using the given traversal mode.

    Parameters (3)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
    • theMode
      traversal strategy (recursive or direct children)
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind): BRepGraph_ChildExplorer

    Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.

    Parameters (3)
    • theGraph
      graph to walk
    • theRoot
      typed root node where the walk begins
    • theTargetKind
      kind of nodes to emit
  • constructor(theGraph: BRepGraph, theProduct: BRepGraph_ProductId, theTargetKind: BRepGraph_NodeId_Kind): BRepGraph_ChildExplorer

    Explore only descendants of the given target kind starting from a product.

    Parameters (3)
    • theGraph
      graph to walk
    • theProduct
      product whose occurrences and topology are explored
    • theTargetKind
      kind of nodes to emit
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind, theMode: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore only descendants of the given target kind using the given traversal mode.

    Parameters (4)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
    • theTargetKind
      kind of nodes to emit
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theProduct: BRepGraph_ProductId, theTargetKind: BRepGraph_NodeId_Kind, theMode: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore only descendants of the given target kind starting from a product, using the given traversal mode.

    Parameters (4)
    • theGraph
      graph to walk
    • theProduct
      product whose occurrences and topology are explored
    • theTargetKind
      kind of nodes to emit
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theAvoidKind: BRepGraph_NodeId_Kind | null | undefined, theEmitAvoidKind: boolean, theMode?: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore descendants while pruning branches at the avoid kind.

    Parameters (5)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
    • theAvoidKind
      node kind to avoid descending into
    • theEmitAvoidKind
      if true, emit matching avoid-kind nodes once before skipping
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind, theAvoidKind: BRepGraph_NodeId_Kind | null | undefined, theEmitAvoidKind: boolean, theMode?: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore descendants of the given target kind while pruning branches at the avoid kind.

    Parameters (6)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
    • theTargetKind
      kind of nodes to emit
    • theAvoidKind
      node kind to avoid descending into
    • theEmitAvoidKind
      if true, emit matching avoid-kind nodes once before skipping
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind, theCumLoc: boolean, theCumOri: boolean, theMode?: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Disambiguates non-product typed ids from the ProductId-specific overload family above and keeps them on the generic NodeId traversal path.

    Parameters (6)
    • theGraph
      graph to walk
    • theRoot
      typed root node where the walk begins
    • theTargetKind
      kind of nodes to emit
    • theCumLoc
      if true, accumulate location down the walk
    • theCumOri
      if true, accumulate orientation down the walk
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theProduct: BRepGraph_ProductId, theTargetKind: BRepGraph_NodeId_Kind, theCumLoc: boolean, theCumOri: boolean, theMode?: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore only descendants of the given target kind starting from a product, with explicit location/orientation control.

    Parameters (6)
    • theGraph
      graph to walk
    • theProduct
      product whose occurrences and topology are explored
    • theTargetKind
      kind of nodes to emit
    • theCumLoc
      if true, accumulate location down the walk
    • theCumOri
      if true, accumulate orientation down the walk
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theRoot: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind, theStartLoc: TopLoc_Location, theStartOri: TopAbs_Orientation, theMode?: BRepGraph_ChildExplorer_TraversalMode): BRepGraph_ChildExplorer

    Explore only descendants of the given target kind with an explicit initial transform.

    Parameters (6)
    • theGraph
      graph to walk
    • theRoot
      root node where the walk begins
    • theTargetKind
      kind of nodes to emit
    • theStartLoc
      initial accumulated location
    • theStartOri
      initial accumulated orientation
    • theMode
      traversal strategy

Instance methods(14)

  • GetConfig(): BRepGraph_ChildExplorer_Config

    Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer.

  • More(): boolean

    True if another matching descendant is available.

  • Next(): void

    Advance to the next matching descendant.

  • Current(): any

    Current matching descendant node with accumulated location and orientation.

  • Returns the immediate parent of Current() in the explored path. Returns invalid NodeId when Current() is the root/self match.

  • CurrentLinkKind(): BRepGraph_ChildExplorer_LinkKind

    Returns how Current() is linked from CurrentParent().

  • Returns the exact parent-owned RefId for Current(), when the current step is represented by a reference entry. Returns invalid RefId for structural links without a dedicated ref entry such as CoEdge->Edge, Occurrence->Product/topology-root.

  • Returns the explicit concrete traversal path from the explorer root to Current().

  • LocationOf(theKind: BRepGraph_NodeId_Kind): TopLoc_Location

    Returns the accumulated location at the most recent ancestor of the given kind.

    Parameters (1)
    • theKind
      node kind to search for in the ancestor chain
    Returns

    accumulated location at the matching ancestor

  • NodeOf(theKind: BRepGraph_NodeId_Kind): BRepGraph_NodeId

    Returns the node id of the most recent ancestor of the given kind.

    Parameters (1)
    • theKind
      node kind to search for in the ancestor chain
    Returns

    node id of the matching ancestor

  • LocationAt(theLevel: number): TopLoc_Location

    Returns the accumulated location at the given stack level.

    Parameters (1)
    • theLevel
      zero-based stack depth (0 = root)
    Returns

    accumulated location at the specified level

  • NodeAt(theLevel: number): BRepGraph_NodeId

    Returns the node id at the given stack level.

    Parameters (1)
    • theLevel
      zero-based stack depth (0 = root)
    Returns

    node id at the specified level

  • Depth(): number

    Number of valid ancestor frames currently on the stack (excluding the sentinel below the root). O(1); avoids the O(depth^2) NodeAt(i) walk used to compute container priority in selection-mode building.

  • Returns a sentinel marking the end of iteration.

BRepGraph_ChildRefId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_CoEdgeId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_CoEdgesOfEdge

Constructors(2)

Instance methods(9)

BRepGraph_CompSolidId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_CompSolidsOfSolid

Constructors(2)

Instance methods(9)

BRepGraph_Compact

Graph compaction algorithm that reclaims removed node slots.
After deduplication or other operations that mark nodes as removed, this algorithm rebuilds the graph with dense index arrays, eliminating all removed nodes and reassigning indices to be contiguous.
Strategy: rebuild-and-swap. A fresh BRepGraph is constructed from non-removed nodes with remapped indices, then move-assigned into the input graph.

Static methods(2)

  • Perform(theGraph: BRepGraph): BRepGraph_Compact_Result

    Run compaction with default options.

    Parameters (1)
    • theGraph
      graph to compact
    Returns

    compaction statistics

  • Perform(theGraph: BRepGraph, theOptions: BRepGraph_Compact_Options): BRepGraph_Compact_Result

    Run compaction with specified options.

    Parameters (2)
    • theGraph
      graph to compact
    • theOptions
      compaction configuration
    Returns

    compaction statistics

BRepGraph_CompoundId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_CompoundsOfChild

Constructors(2)

Instance methods(9)

BRepGraph_Copy

Graph-to-graph deep copy.
Produces a new BRepGraph from an existing one in a single bottom-up pass, avoiding the 5-7 traversals of BRepTools_Modifier used by BRepBuilderAPI_Copy.
Two copy modes:

  • External: source and target are different graphs. Target receives the copied data.
  • Self-copy: source and target are the same graph. The specified sub-graph is duplicated with new entity IDs; shared dependencies (geometry, vertices referenced from outside the sub-graph) are preserved.
    Geometry and mesh policies are controlled by the GeomPolicy and MeshPolicy enums.
    Typical usage
BRepGraphaGraph; aGraph.Shapes().Add(myShape); BRepGraphaCopy; BRepGraph_Copy::Perform(aGraph,aCopy); TopoDS_ShapeaShape=aCopy.Shapes().Shape();

Static methods(2)

  • Perform(theSourceGraph: BRepGraph, theTargetGraph: BRepGraph, theGeomPolicy?: BRepGraph_Copy_GeomPolicy, theMeshPolicy?: BRepGraph_Copy_MeshPolicy, theCachePolicy?: BRepGraph_Copy_CachePolicy): boolean

    Copy the entire source graph into the target graph.
    Self-copy (theSourceGraph == theTargetGraph): Identity no-op, returns true immediately.
    External copy to empty target (theTargetGraph.IsEmpty()): Uses identity-mapped fast path (old index == new index).
    External copy to non-empty target: Uses explicit mapping; IDs in theTargetGraph will differ from theSourceGraph. Entities from theSourceGraph are appended to theTargetGraph.

    Parameters (5)
    • theSourceGraph
      a pre-built BRepGraph (must not be empty)
    • theTargetGraph
      destination graph (may already contain data)
    • theGeomPolicy
      geometry handle policy (default: Copy)
    • theMeshPolicy
      mesh data policy (default: Copy)
    • theCachePolicy
    Returns

    true on success, false on failure (empty source)

  • CopyNode(theSourceGraph: BRepGraph, theTargetGraph: BRepGraph, theNodeId: BRepGraph_NodeId, theGeomPolicy?: BRepGraph_Copy_GeomPolicy, theMeshPolicy?: BRepGraph_Copy_MeshPolicy, theCachePolicy?: BRepGraph_Copy_CachePolicy): BRepGraph_NodeId

    Copy a single node sub-graph of any kind (Face, Shell, Solid, Wire, Edge, Vertex, etc.). The target graph receives the specified node and all entities it references.
    External copy (theSourceGraph != theTargetGraph): New entities are appended to theTargetGraph. Entities already present in theTargetGraph are reused (not duplicated).
    Self-copy (theSourceGraph == theTargetGraph): The specified sub-graph is duplicated with new entity IDs within the same graph. Shared dependencies (vertices, edges referenced from outside the sub-graph) are preserved as-is.

    Parameters (6)
    • theSourceGraph
      a pre-built BRepGraph
    • theTargetGraph
      destination graph (may already contain data)
    • theNodeId
      node identifier (any kind)
    • theGeomPolicy
      geometry handle policy (default: Copy)
    • theMeshPolicy
      mesh data policy (default: Copy)
    • theCachePolicy
    Returns

    the mapped root NodeId in theTargetGraph, or invalid NodeId on failure

BRepGraph_CopyRemap

Immutable context passed to layer copy callbacks.
The structural copy algorithm owns remap construction. Layers receive this context and decide how to copy their own representation without exposing layer details back to BRepGraph_Copy.

Constructors(2)

  • constructor(theSourceGraph: BRepGraph, theTargetGraph: BRepGraph, theItemRemap: any, theMode: BRepGraph_CopyRemap_Mode): BRepGraph_CopyRemap
    Parameters (4)
    • theSourceGraph
    • theTargetGraph
    • theItemRemap
    • theMode
  • constructor(theSourceGraph: BRepGraph, theTargetGraph: BRepGraph, theMappingKind: BRepGraph_CopyRemap_MappingKind, theMode: BRepGraph_CopyRemap_Mode): BRepGraph_CopyRemap

    Identity-mapping constructor for full identity copy into an empty target. Source item ids are returned directly as target item ids after validation.

    Parameters (4)
    • theSourceGraph
    • theTargetGraph
    • theMappingKind
    • theMode

Instance methods(12)

BRepGraph_Data

Internal storage for BRepGraph (PIMPL).
All topology definition data and UIDs live in myIncStorage. Access via myIncStorage.Edges, myIncStorage.Faces, etc.

Constructors(1)

Properties(9)

BRepGraph_Deduplicate

Deep geometry deduplication algorithm over an existing BRepGraph.
This algorithm canonicalizes deep-equal geometry references (surfaces and 3D curves) using GeomHash hashers. It updates face/edge definition links to canonical geometry nodes and can record lineage in graph history.
First implementation intentionally does not merge edge/face definitions yet.

Static methods(2)

  • Perform(theGraph: BRepGraph): BRepGraph_Deduplicate_Result

    Run deduplication on a built graph.

    Parameters (1)
    • theGraph
      graph to update
    Returns

    dedup statistics

  • Perform(theGraph: BRepGraph, theOptions: BRepGraph_Deduplicate_Options): BRepGraph_Deduplicate_Result

    Run deduplication on a built graph.

    Parameters (2)
    • theGraph
      graph to update
    • theOptions
      dedup configuration
    Returns

    dedup statistics

BRepGraph_DeferredScope

RAII guard for batch mutation scopes with deferred invalidation.
Activates deferred invalidation on construction and flushes it on destruction, followed by CommitMutation validation. Guarantees exception-safe cleanup: when this guard owns deferred mode, it is always closed and boundary checks are executed at scope exit. EndDeferredInvalidation() batch-propagates SubtreeGen upward, then CommitMutation() validates relation consistency and active-entity counts.
Re-entrant: if deferred mode is already active (e.g., nested guard), the inner guard is a no-op. Only the outermost guard flushes and commits, so nested scopes do not create separate transaction or validation boundaries.
Usage:

{ BRepGraph_DeferredScopeaScope(theGraph); for(inti=0;i<N;++i) { //mutations } }//EndDeferredInvalidation+CommitMutationcalledhere

Constructors(1)

BRepGraph_DefsIterator_ChildOfCompoundTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_CoEdgeOfWireTraits

Constructors(1)

Static methods(4)

BRepGraph_DefsIterator_EdgeOfWireTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_FaceOfShellTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_OccurrenceOfProductTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_ShellOfSolidTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_SolidOfCompSolidTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_WireOfFaceTraits

Constructors(1)

Static methods(5)

BRepGraph_EdgeId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_EdgesOfVertex

Constructors(2)

Instance methods(9)

BRepGraph_EditorView

Instance methods(18)

BRepGraph_FaceId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_FaceRefId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_FacesOfWire

Constructors(2)

Instance methods(9)

BRepGraph_ItemId

Generic BRepGraph item identifier covering definitions and references. Use-records are NOT included - they are session-local, not graph identity.

Constructors(3)

Instance methods(11)

  • IsValid(): boolean

    Return true if this item addresses a graph object.

  • ItemDomain(): BRepGraph_ItemId_Domain

    Return the addressed domain.

  • IsNode(): boolean

    Return true if this item addresses a definition node.

  • IsReference(): boolean

    Return true if this item addresses a reference entry.

  • Convert to node id. Returns invalid id for non-node items.

  • Convert to reference id. Returns invalid id for non-reference items.

  • NodeKind(): BRepGraph_NodeId_Kind

    Return node kind. Valid only when IsNode() is true.

  • RefKind(): BRepGraph_RefId_Kind

    Return reference kind. Valid only when IsReference() is true.

  • RawKind(): number

    Return item kind encoded in its own domain enum space.

  • Kind(): number

    Return item kind encoded in its own domain enum space.

  • Index(): number

    Return item per-kind index.

BRepGraph_ItemUID

Durable BRepGraph item identity covering definition nodes and reference entries.
BRepGraph_ItemId is a transient structural address. BRepGraph_ItemUID is the persistent identity assigned at item creation and kept stable across compaction and vector reordering. Representation/use records are not addressed here because they do not have persisted identity.

Constructors(1)

Static methods(3)

Instance methods(9)

  • IsValid(): boolean

    Return true if this UID has a non-sentinel counter and a valid domain/kind pair.

  • ItemDomain(): BRepGraph_ItemUID_Domain

    Return the addressed identity domain.

  • IsNode(): boolean
  • IsReference(): boolean
  • NodeKind(): BRepGraph_NodeId_Kind

    Return node kind. Valid only for node UIDs.

  • RefKind(): BRepGraph_RefId_Kind

    Return reference kind. Valid only for reference UIDs.

  • RawKind(): number

    Return item kind encoded in its own domain enum space.

  • Counter(): number

    Return the graph-wide monotonic UID counter.

  • HashValue(): number

    Compute a hash value compatible with operator==.

BRepGraph_Layer

Abstract base class for named attribute layers.
A layer groups per-node and per-reference metadata under a unique name with lifecycle callbacks. Layers are registered on BRepGraph and automatically notified when nodes or references are removed, remapped (compact), or modified.
Derived layers store domain-specific data (names, colors, materials, etc.) in internal maps keyed by BRepGraph_NodeId or BRepGraph_RefId. The lifecycle callbacks ensure data consistency across all graph mutations.
Node Modification Events
Layers subscribe to node modification events by overriding SubscribedKinds() to return a non-zero bitmask of Kind values. When a subscribed node kind is modified, OnNodeModified() (immediate mode) or OnNodesModified() (deferred batch mode) is called. Layers with SubscribedKinds() == 0 (default) incur zero dispatch overhead.
Reference Modification Events
Layers subscribe to reference modification events by overriding SubscribedRefKinds() to return a non-zero bitmask of BRepGraph_RefId::Kind values. When a subscribed ref kind is mutated, OnRefModified() (immediate mode) or OnRefsModified() (deferred batch mode) is called. Removal is always dispatched via OnRefRemoved() regardless of subscription.
Thread safety
Callback dispatch is single-threaded (called from mutation paths). Layers that only provide read access can skip internal locking.

Static methods(4)

Instance methods(18)

  • Layer type identity (unique within a graph).

  • Layer identity (unique within a graph).

  • Called when a node is soft-removed without a replacement.

    Parameters (1)
    • theNode
      the removed node Layers should discard or archive data associated with it.
    Remarks

    Warning: Layer callbacks must not throw. They are called from noexcept notification paths (MutGuard destructors, deferred invalidation flush).

  • Dispatch a generic item removal to the matching typed removal callback. This is a non-virtual convenience entry point; typed callbacks remain the extension points for derived layers.

    Parameters (1)
    • theItem
      the removed definition or reference
  • OnNodeReplaced(theOldNode: BRepGraph_NodeId, theNewNode: BRepGraph_NodeId): void

    Called when a node is soft-removed and replaced by another node.

    Parameters (2)
    • theOldNode
      the removed node
    • theNewNode
      the node that replaces theOldNode Layers that store node-keyed data should migrate from theOldNode to theNewNode when the replacement kind is compatible. This is a structural lifecycle event, not an algorithmic history record.
    Remarks

    Warning: Layer callbacks must not throw. They are called from noexcept notification paths (MutGuard destructors, deferred invalidation flush).

  • CopyTo(theCopy: BRepGraph_CopyRemap): void

    Copy this source layer data into another graph. The source graph is the graph this layer is attached to (Graph()).

    Parameters (1)
    • theCopy
      source graph, target graph, and source item id -> target item id remap
    Remarks

    Warning: This callback may allocate and is intentionally not noexcept.

  • Mark all cached values dirty (bulk invalidation).

  • Clear(): void

    Clear all stored data.

  • SubscribedKinds(): number

    Return a bitmask of BRepGraph_NodeId::Kind values this layer subscribes to. Only modification events matching subscribed kinds are dispatched. Default: 0 (no subscription - no modification events received). Override to receive OnNodeModified/OnNodesModified callbacks. The returned value must be constant for the lifetime of the layer.

  • Called in immediate (non-deferred) mode after a single node is modified. Only dispatched if the node's kind matches SubscribedKinds(). Default: no-op.

    Parameters (1)
    • theNode
      the modified node
  • Dispatch a generic item modification to the matching typed modification callback. This is a non-virtual convenience entry point; typed callbacks remain the extension points for derived layers.

    Parameters (1)
    • theItem
      the modified definition or reference
  • Called after EndDeferredInvalidation() with all nodes modified during the deferred scope. Only dispatched if at least one modified node's kind matches SubscribedKinds(). The array may contain nodes of kinds not subscribed to - layers should filter internally if needed. Default: no-op.

    Parameters (1)
    • theModifiedNodes
      all modified, non-removed nodes
  • Return a bitmask of BRepGraph_RefId::Kind values this layer subscribes to. Only modification events matching subscribed ref kinds are dispatched. Default: 0 (no subscription). Must be constant for the layer's lifetime.

  • Called when a reference is soft-deleted via RemoveRef(). No replacement concept - refs are simply removed (unlike nodes which can have a replacement during sewing or deduplication). Dispatched to all layers regardless of SubscribedRefKinds(). Default: no-op.

    Parameters (1)
    • theRef
      the removed reference
  • Called in immediate (non-deferred) mode after a single ref is mutated. Only dispatched if the ref's kind matches SubscribedRefKinds(). Default: no-op.

    Parameters (1)
    • theRef
      the modified reference
  • Called after EndDeferredInvalidation() with all refs modified during the deferred scope. Only dispatched if at least one modified ref's kind matches SubscribedRefKinds(). The array may contain refs of kinds not subscribed to - layers should filter internally if needed. Default: no-op.

    Parameters (1)
    • theModifiedRefs
      all modified, non-removed refs
  • Revision(): number

    Monotonic revision counter incremented by touch() on every observable state change. Consumers compare stored revisions to detect staleness in O(1). Derived layers MUST call touch() from their mutators.

BRepGraph_LayerDeferred

Base layer for postponed graph item loading.
The layer stores provider-neutral deferred representation records and owns the lock state through BRepGraph_LayerLock. Format-specific loaders, such as ODE or STEP, should derive from this class or use the same representation contract rather than storing deferred ownership in topology definitions.

Constructors(1)

Static methods(3)

Instance methods(28)

BRepGraph_LayerDeferred_Entry_RepresentationStorage

Constructors(2)

Instance methods(8)

BRepGraph_LayerHistory

History layer for BRepGraph.
BRepGraph_LayerHistory maintains an append-only log of modification events and per-kind lookup maps for efficient queries. Four event kinds are tracked (see BRepGraph_LayerHistory::Kind):

  • Modified: input -> { modified images } (default).
  • Generated: input -> { generated images } (new entities born from the input but not sharing its identity).
  • Deleted: input has been consumed and has no image in the result.
  • Replaced: input was structurally detached and replaced by another node; this maps as Modified and also marks the input as deleted.
    Recording can be toggled on/off at runtime. Graph-owned history is registered as a layer and accessed through #Ensure / #Find; algorithms wrapping OCCT's BRepTools_History can import results through Absorb.

Constructors(1)

Static methods(3)

Instance methods(43)

  • Layer type identity.

  • Layer display name.

  • Record(theOpLabel: TCollection_AsciiString, theOriginal: BRepGraph_NodeId, theReplacements: NCollection_Array1_BRepGraph_NodeId, theKind: BRepGraph_LayerHistory_Kind): void

    Record a modification: theOriginal was replaced by theReplacements.

    Parameters (4)
    • theOpLabel
      human-readable operation name
    • theOriginal
      node id before the operation
    • theReplacements
      node ids after the operation
    • theKind
      classification of this record (default Modified)
    Remarks

    Note: When theReplacements is empty the record is auto-downgraded to Kind::Deleted and theOriginal is added to the deleted set, regardless of theKind. Use RecordDeleted directly for the deletion case to avoid relying on this implicit conversion.

  • Record(theRecordIdx: number): BRepGraph_LayerHistory_Event

    Access a record by index (0-based).

    Parameters (1)
    • theRecordIdx
      zero-based index into the records vector
    Returns

    the history record at the given index

  • RecordBatch(theOpLabel: TCollection_AsciiString, theOriginals: NCollection_Array1_BRepGraph_NodeId, theReplacements: NCollection_Array1_BRepGraph_NodeId, theExtraInfo?: TCollection_AsciiString, theKind?: BRepGraph_LayerHistory_Kind): void

    Record a batch of 1-to-1 modifications in a single history event. Each original is paired with the replacement at the same logical position. More efficient than calling Record() in a loop: creates one HistoryRecord and updates the per-kind maps with minimal overhead.

    Parameters (5)
    • theOpLabel
      human-readable operation name
    • theOriginals
      node ids before the operation
    • theReplacements
      node ids after the operation (same length)
    • theExtraInfo
      optional diagnostic info stored on the record
    • theKind
      classification of this record (default Modified)
  • Record that a collection of inputs has been consumed by the operation and has no image in the result. Each input is appended to the deleted set and emits a single audit record with empty replacements.

    Parameters (2)
    • theOpLabel
      human-readable operation name
    • theDeleted
      node ids that have been removed
  • RecordReplaced(theOpLabel: TCollection_AsciiString, theOriginal: BRepGraph_NodeId, theReplacement: BRepGraph_NodeId): void

    Record replacements: each original is logically removed/detached and continued by the corresponding replacement. Replaced records participate in modified-image queries and also mark originals as deleted.

    Parameters (3)
    • theOpLabel
    • theOriginal
    • theReplacement
  • Record a batch of 1-to-1 replacements in a single history event.

    Parameters (4)
    • theOpLabel
    • theOriginals
    • theReplacements
    • theExtraInfo
  • RecordUid(theOpLabel: TCollection_AsciiString, theOriginal: BRepGraph_UID, theReplacements: NCollection_Array1_BRepGraph_UID, theKind?: BRepGraph_LayerHistory_Kind): void

    Record a UID-keyed modification/generation event.
    This is the durable-history path for operations whose source and result identities may live in different BRepGraph instances. Existing NodeId records remain available for in-graph algorithms; UID records are queried directly by cross-graph consumers.

    Parameters (4)
    • theOpLabel
    • theOriginal
    • theReplacements
    • theKind
  • Record UID-keyed deletions.

    Parameters (2)
    • theOpLabel
    • theDeleted
  • RecordItemUid(theOpLabel: TCollection_AsciiString, theOriginal: BRepGraph_ItemUID, theReplacements: NCollection_Array1_BRepGraph_ItemUID, theKind?: BRepGraph_LayerHistory_Kind): void

    Record an all-domain ItemUID-keyed modification/generation event.

    Parameters (4)
    • theOpLabel
    • theOriginal
    • theReplacements
    • theKind
  • Record ItemUID-keyed deletions.

    Parameters (2)
    • theOpLabel
    • theDeleted
  • Import a BRepTools_History into this graph-native history log.
    Iterates theInputs, queries theSource for Modified / Generated / IsRemoved, translates each TopoDS_Shape image to a NodeId via theOutputs, and emits the corresponding records.
    Semantics:

    • For every input shape whose Modified() list is non-empty: emit a Modified record.
    • For every input shape whose Generated() list is non-empty: emit a Generated record.
    • For every input shape with IsRemoved() == true: accumulate into a single Deleted record (IsRemoved takes precedence over Modified/Generated to handle a known OCCT bug where a shape can appear in both the removed set and the generated map).
      Output TopoDS_Shapes that do not appear in theOutputs are silently dropped (expected for subshapes merged into a parent compound whose identity is preserved at a higher level).
    Parameters (4)
    • theInputs
      TopoDS_Shape -> NodeId for every input subshape that should be tracked
    • theOutputs
      TopoDS_Shape -> NodeId for every subshape added to the graph by this operation (typically from BRepGraph::ShapesView::Add with TrackAddedNodes)
    • theSource
      BRepTools_History from the OCCT algorithm. Null is accepted (no-op).
    • theOpLabel
      record label written into every emitted record
  • Import a BRepTools_History using persistent UIDs from source/result graphs.
    This overload is the canonical bridge for cross-graph algorithms: input shapes are resolved in theInputGraph, output shapes are resolved in theOutputGraph, and the resulting history is stored by UID.

    Parameters (6)
    • theInputGraph
    • theOutputGraph
    • theInputs
    • theOutputs
    • theSource
    • theOpLabel
  • Walk backwards from a modified node to its original. Follows the reverse map recursively until a root is reached.

    Parameters (1)
    • theModified
      node id to trace back
    Returns

    the root original node id, or theModified itself if not found

  • Walk forwards from an original node to all derived nodes, including both Modified and Generated descendants. Follows the forward maps recursively, collecting every transitively-reachable descendant (intermediate nodes and leaves alike, but not theOriginal itself).

    Parameters (1)
    • theOriginal
      node id to trace forward
    Returns

    all transitively derived node ids in breadth-first order

  • Direct lookup of the Modified images of theOriginal, non-recursive.

    Parameters (1)
    • theOriginal
      node id to query
    Returns

    pointer to the stored vector, or nullptr if theOriginal has no Modified record (note: nullptr does not imply IsDeleted).

  • UID-keyed Modified images stored directly in this history.

    Parameters (1)
    • theUID
  • ItemUID-keyed Modified images stored directly in this history.

    Parameters (1)
    • theUID
  • UID-keyed convenience: Modified images of the input identified by theUID, resolved against theGraph. Returns an empty vector if the UID cannot be resolved or has no Modified record.

    Parameters (2)
    • theGraph
      graph used to translate UID <-> NodeId
    • theUID
      UID of the input entity
    Returns

    UIDs of the modified images (in record-insertion order)

  • Direct lookup of the Generated images of theOriginal, non-recursive.

    Parameters (1)
    • theOriginal
      node id to query
    Returns

    pointer to the stored vector, or nullptr if theOriginal has no Generated record.

  • UID-keyed Generated images stored directly in this history.

    Parameters (1)
    • theUID
  • ItemUID-keyed Generated images stored directly in this history.

    Parameters (1)
    • theUID
  • UID-keyed convenience: Generated images. See FindModified for the resolution contract.

    Parameters (2)
    • theGraph
      graph used to translate UID <-> NodeId
    • theUID
      UID of the input entity
    Returns

    UIDs of the generated images (in record-insertion order)

  • IsDeleted(theOriginal: BRepGraph_NodeId): boolean

    Test whether theOriginal was deleted by some recorded operation.

    Parameters (1)
    • theOriginal
      node id to query
    Returns

    true if theOriginal is in the deleted set

  • IsDeleted(theUID: BRepGraph_UID): boolean

    UID-keyed deletion test stored directly in this history.

    Parameters (1)
    • theUID
  • IsDeleted(theUID: BRepGraph_ItemUID): boolean

    ItemUID-keyed deletion test stored directly in this history.

    Parameters (1)
    • theUID
  • IsDeleted(theGraph: BRepGraph, theUID: BRepGraph_UID): boolean

    UID-keyed convenience: deletion test.

    Parameters (2)
    • theGraph
      graph used to resolve the UID
    • theUID
      UID of the input entity
    Returns

    true if the resolved NodeId is in the deleted set

  • Borrowed access to the full deleted set.

    Returns

    reference to the deleted-node set

  • Direct lookup of all immediate node origins of theDerived. A derived entity can have more than one parent in reconstructive algorithms.

    Parameters (1)
    • theDerived
  • UID-keyed deleted set stored directly in this history.

  • UID-keyed convenience: dump the full deleted set as UIDs.

    Parameters (1)
    • theGraph
      graph used to translate NodeId -> UID
    Returns

    UIDs of all deleted entities (insertion order is not stable)

  • HasKnownInput(theUID: BRepGraph_UID): boolean

    Test whether theUID was registered as an operation input.

    Parameters (1)
    • theUID
  • Test whether theUID was registered as an operation input.

    Parameters (1)
    • theUID
  • ItemUID-keyed deleted set stored directly in this history.

  • NbRecords(): number

    Number of recorded history events.

    Returns

    record count

  • SetEnabled(theVal: boolean): void

    Enable or disable history recording.

    Parameters (1)
    • theVal
      true to enable, false to disable
  • IsEnabled(): boolean

    Query whether history recording is enabled.

    Returns

    true if recording is active

  • Clear(): void

    Clear all records and lookup maps.

  • Layer removal callback. Records pure graph deletions when enabled.

    Parameters (1)
    • theNode
  • CopyTo(theCopy: BRepGraph_CopyRemap): void

    Copy history records whose source items have copied target items.

    Parameters (1)
    • theCopy
  • Clear derived caches by dropping collected history.

BRepGraph_LayerIterator

Iterator over registered layers in a BRepGraph_LayerRegistry.
Provides zero-allocation iteration with OCCT More()/Next()/Value() pattern and STL range-for via begin()/end().

//Range-for: for(constocc::handle<BRepGraph_Layer>&aLayer: BRepGraph_LayerIterator(aGraph.LayerRegistry())) doSomething(aLayer); //Traditional: for(BRepGraph_LayerIteratoranIt(aGraph.LayerRegistry());anIt.More();anIt.Next()) doSomething(anIt.Value());

Constructors(1)

Instance methods(6)

BRepGraph_LayerLock

Owner metadata layer for owned BRepGraph items.
Uses a root-based ownership model: only the highest owned item per group is stored in the map. All descendants receive the fast IsOwned bit-flag via automatic downward propagation. Owner lookup traverses upward to find the root entry.
Overlapping roots are forbidden: SetOwner rejects if the item is already covered by an ancestor root with a different GUID.
HasOwner() checks the IsOwned bit-flag (O(1)). FindOwnerId() traverses upward to find the root entry (O(depth)).

Constructors(1)

Static methods(3)

Instance methods(26)

  • Return this layer type GUID.

  • FindOwnerId(theItem: BRepGraph_ItemId, theOwnerId: Standard_GUID): boolean

    Return owner ID for an item. Traverses upward for nodes/refs to find the root owner entry.

    Parameters (2)
    • theItem
    • theOwnerId
      Mutated in place; read the updated value from this argument after the call.
    Returns

    true when the item has a resolved owner and theOwnerId was filled.

  • FindOwnerId(theNode: BRepGraph_NodeId, theOwnerId: Standard_GUID): boolean

    Return owner ID for a node.

    Parameters (2)
    • theNode
    • theOwnerId
      Mutated in place; read the updated value from this argument after the call.
  • FindOwnerId(theRef: BRepGraph_RefId, theOwnerId: Standard_GUID): boolean

    Return owner ID for a reference.

    Parameters (2)
    • theRef
    • theOwnerId
      Mutated in place; read the updated value from this argument after the call.
  • HasOwner(theItem: BRepGraph_ItemId): boolean

    Return true if an item's IsOwned bit-flag is set. This is an O(1) check. Use FindOwnerId() to resolve the actual owner GUID.

    Parameters (1)
    • theItem
  • HasOwner(theNode: BRepGraph_NodeId): boolean

    Return true if a node's IsOwned bit-flag is set.

    Parameters (1)
    • theNode
  • HasOwner(theRef: BRepGraph_RefId): boolean

    Return true if a reference's IsOwned bit-flag is set.

    Parameters (1)
    • theRef
  • SetOwner(theItem: BRepGraph_ItemId, theOwnerId: Standard_GUID): void

    Register an owner ID and set the graph item's ownership flag. For nodes, propagates the IsOwned bit-flag to all descendants. Rejects if the item is already covered by an ancestor root with a different GUID.

    Parameters (2)
    • theItem
    • theOwnerId
  • SetOwner(theNode: BRepGraph_NodeId, theOwnerId: Standard_GUID): void

    Register an owner ID and set the node ownership flag.

    Parameters (2)
    • theNode
    • theOwnerId
  • SetOwner(theRef: BRepGraph_RefId, theOwnerId: Standard_GUID): void

    Register an owner ID and set the reference ownership flag.

    Parameters (2)
    • theRef
    • theOwnerId
  • SetOwner(theItem: BRepGraph_ItemId, theOwnerId: Standard_GUID, theToUpdateRevision: boolean): boolean

    Register an owner ID and set the graph item's ownership flag. Returns true when owner storage changed. Revision update can be deferred by bulk callers.

    Parameters (3)
    • theItem
    • theOwnerId
    • theToUpdateRevision
  • Remove an owner and clear the graph item's ownership flag. For node roots, clears the IsOwned bit-flag on all descendants.

    Parameters (1)
    • theItem
  • Remove an owner and clear the node ownership flag.

    Parameters (1)
    • theNode
  • Remove an owner and clear the reference ownership flag.

    Parameters (1)
    • theRef
  • UnsetOwner(theItem: BRepGraph_ItemId, theOwnerId: Standard_GUID): void

    Remove an owner and clear the graph item's ownership flag if owner ID matches.

    Parameters (2)
    • theItem
    • theOwnerId
  • HasOwners(): boolean

    Return true if at least one root entry exists.

  • ReserveOwners(theNbOwners: number): void

    Reserve owner map buckets for bulk registration.

    Parameters (1)
    • theNbOwners
  • TouchOwners(): void

    Mark owner metadata changed after a bulk update.

  • Layer identity (unique within a graph).

  • Called when a node is soft-removed without a replacement.

    Parameters (1)
    • theNode
      the removed node Layers should discard or archive data associated with it.
    Remarks

    Warning: Layer callbacks must not throw. They are called from noexcept notification paths (MutGuard destructors, deferred invalidation flush).

  • OnNodeReplaced(theOldNode: BRepGraph_NodeId, theNewNode: BRepGraph_NodeId): void

    Called when a node is soft-removed and replaced by another node.

    Parameters (2)
    • theOldNode
      the removed node
    • theNewNode
      the node that replaces theOldNode Layers that store node-keyed data should migrate from theOldNode to theNewNode when the replacement kind is compatible. This is a structural lifecycle event, not an algorithmic history record.
    Remarks

    Warning: Layer callbacks must not throw. They are called from noexcept notification paths (MutGuard destructors, deferred invalidation flush).

  • CopyTo(theCopy: BRepGraph_CopyRemap): void

    Copy this source layer data into another graph. The source graph is the graph this layer is attached to (Graph()).

    Parameters (1)
    • theCopy
      source graph, target graph, and source item id -> target item id remap
    Remarks

    Warning: This callback may allocate and is intentionally not noexcept.

  • Called when a reference is soft-deleted via RemoveRef(). No replacement concept - refs are simply removed (unlike nodes which can have a replacement during sewing or deduplication). Dispatched to all layers regardless of SubscribedRefKinds(). Default: no-op.

    Parameters (1)
    • theRef
      the removed reference
  • Mark all cached values dirty (bulk invalidation).

  • Clear(): void

    Clear all stored data.

BRepGraph_LayerParametric

Base layer for graph-owned parametric generators.
The class defines the common instance identity, generation flags, mesh quality controls, and graph access helpers shared by higher-level parametric layers. Concrete layers such as BRepGraphPrim box, plane, or loft generators build their own parameter schema and manifest storage on top of this base.

Static methods(5)

  • GenerationMask(theFlag: BRepGraph_LayerParametric_GenerationFlag): number

    Convert one generation flag into its bit-mask value.

    Parameters (1)
    • theFlag
      generation flag to convert
    Returns

    bit-mask value for the requested generation flag

  • HasGenerationFlag(theFlags: number, theFlag: BRepGraph_LayerParametric_GenerationFlag): boolean

    Return true when the flag mask contains the requested generation flag.

    Parameters (2)
    • theFlags
      generation mask built from GenerationFlag bits
    • theFlag
      generation flag to test
    Returns

    true when the flag is present in the mask

  • MeshQualityValue(theQuality: BRepGraph_LayerParametric_MeshQuality, theVeryCoarse: number, theCoarse: number, theMedium: number, theFine: number, theVeryFine: number): number

    Select one integer value from a mesh-quality ladder.

    Parameters (6)
    • theQuality
      requested shared mesh quality
    • theVeryCoarse
      value for MeshQuality::VeryCoarse
    • theCoarse
      value for MeshQuality::Coarse
    • theMedium
      value for MeshQuality::Medium
    • theFine
      value for MeshQuality::Fine
    • theVeryFine
      value for MeshQuality::VeryFine
    Returns

    selected value for the requested quality

  • get_type_name(): string

Instance methods(1)

BRepGraph_LayerRegistry

Dense GUID-keyed runtime registry of graph layers.
Stores registered layers in a compact vector for O(1) slot access and a GUID-to-slot map for O(1) lookup by stable public identity.

Constructors(1)

Instance methods(23)

  • RegisterLayer(theLayer: BRepGraph_Layer): number

    Register a layer. Replaces an existing layer with the same GUID.

    Parameters (1)
    • theLayer
    Returns

    slot index in the internal dense vector.

  • Remove a layer by GUID.

    Parameters (1)
    • theGUID
  • Find a layer by GUID. Returns null handle if not found.

    Parameters (1)
    • theGUID
  • FindSlot(theGUID: Standard_GUID, theSlot?: number): { returnValue: boolean; theSlot: number }

    Return current slot for a GUID.

    Parameters (2)
    • theGUID
    • theSlot
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theSlot: updated value from the call.
  • Layer(theSlot: number): BRepGraph_Layer

    Return layer by slot index, or null handle if the slot is out of range.

    Parameters (1)
    • theSlot
  • NbLayers(): number

    Number of registered layers.

  • True if any registered layer subscribes to node modification events.

  • Bitwise OR of all registered layer node subscription masks.

  • Dispatch OnNodeRemoved to all registered layers.

    Parameters (1)
    • theNode
  • Dispatch generic item removal to all registered layers.

    Parameters (1)
    • theItem
  • Dispatch OnNodeReplaced to all registered layers.

    Parameters (2)
    • theOldNode
    • theNewNode
  • Dispatch OnNodeModified to subscribed layers.

    Parameters (1)
    • theNode
  • Dispatch generic item modification through the matching typed subscription path.

    Parameters (1)
    • theItem
  • DispatchNodesModified(theModifiedNodes: NCollection_Array1_BRepGraph_NodeId, theModifiedKindsMask: number): void

    Dispatch OnNodesModified to subscribed layers.

    Parameters (2)
    • theModifiedNodes
    • theModifiedKindsMask
  • CopyLayersTo(theTargetGraph: BRepGraph, theItemRemap: any, theMode: BRepGraph_CopyRemap_Mode): void

    Ask every registered source layer to copy itself into the target graph. For Mode::Compact, layers are unregistered first and CopyTo creates fresh instances.

    Parameters (3)
    • theTargetGraph
      target graph to receive layer data
    • theItemRemap
      source -> target item id mapping
    • theMode
      Copy or Compact semantics
  • CopyLayersTo(theTargetGraph: BRepGraph, theMappingKind: BRepGraph_CopyRemap_MappingKind, theMode: BRepGraph_CopyRemap_Mode): void

    Ask every registered source layer to copy itself using identity mapping. Source item ids are the same as target item ids (full identity copy).

    Parameters (3)
    • theTargetGraph
      target graph to receive layer data
    • theMappingKind
      identity or explicit mapping
    • theMode
      Copy or Compact semantics
  • True if any registered layer subscribes to reference modification events.

  • Bitwise OR of all registered layer reference subscription masks.

  • Dispatch OnRefRemoved to all registered layers (unconditional - not filtered).

    Parameters (1)
    • theRef
  • Dispatch OnRefModified to subscribed layers (immediate mode).

    Parameters (1)
    • theRef
  • DispatchRefsModified(theModifiedRefs: NCollection_Array1_BRepGraph_RefId, theModifiedRefKindsMask: number): void

    Dispatch OnRefsModified to subscribed layers (deferred/batch mode).

    Parameters (2)
    • theModifiedRefs
    • theModifiedRefKindsMask
  • ClearAll(): void

    Clear all registered layer data without unregistering services.

  • Invalidate all registered layer data.

BRepGraph_LayerTopoSupplement

Runtime-only storage for supplemental TopoDS topology fragments.
This layer stores non-core topology extracted from a source shape and attached to supported core graph owners. These attachments are not serialized and are intended only to preserve live TopoDS -> Graph -> TopoDS behavior.

Constructors(1)

Static methods(3)

Instance methods(14)

  • Return the runtime type GUID for this layer instance.

  • Return a short stable layer name for diagnostics and registry lookup.

  • FindByUid(theUid: number): BRepGraph_LayerTopoSupplement_Entry

    Find one attachment entry by its layer-local uid.

    Parameters (1)
    • theUid
      layer-local attachment uid
    Returns

    pointer to the entry, or nullptr when not found

  • AttachedTo(theOwner: BRepGraph_NodeId): number[]

    Return all attachment uids currently owned by one core node.

    Parameters (1)
    • theOwner
      core topology owner node
    Returns

    owner-local insertion-ordered list of attachment uids

  • AddAttachment(theOwner: BRepGraph_NodeId, theKind: BRepGraph_LayerTopoSupplement_AttachmentKind, theShape: TopoDS_Shape): number

    Add one supplemental shape attachment to a supported core owner node. Supported owner kinds are vertex, edge, face, shell, solid, compsolid, and compound.

    Parameters (3)
    • theOwner
      active core topology owner
    • theKind
      semantic attachment kind
    • theShape
      attached supplemental shape
    Returns

    non-zero layer-local uid on success, 0 on rejection

  • AddAttachmentWithUid(theOwner: BRepGraph_NodeId, theUid: number, theKind: BRepGraph_LayerTopoSupplement_AttachmentKind, theShape: TopoDS_Shape): boolean

    Add one supplemental shape attachment with an explicitly preserved uid. Supported owner kinds are vertex, edge, face, shell, solid, compsolid, and compound.

    Parameters (4)
    • theOwner
      active core topology owner
    • theUid
      layer-local attachment uid to preserve
    • theKind
      semantic attachment kind
    • theShape
      attached supplemental shape
    Returns

    true on success, false when the uid or input is rejected

  • RemoveAttachment(theUid: number): boolean

    Remove one supplemental attachment by uid.

    Parameters (1)
    • theUid
      layer-local attachment uid
    Returns

    true when the attachment existed and was removed

  • Validate(): void

    Validate internal owner/uid bookkeeping invariants.

  • Drop all attachments owned by a removed node.

    Parameters (1)
    • theNode
      removed core node
  • OnNodeReplaced(theOldNode: BRepGraph_NodeId, theNewNode: BRepGraph_NodeId): void

    Migrate attachments from one owner node to another compatible node.

    Parameters (2)
    • theOldNode
      previous owner node
    • theNewNode
      replacement owner node
  • CopyTo(theCopy: BRepGraph_CopyRemap): void

    Copy remapped attachments to the target graph.

    Parameters (1)
    • theCopy
  • Invalidate all cached state in the layer.

  • Clear(): void

    Remove every stored supplemental attachment.

BRepGraph_NodeId

Lightweight typed index into a per-kind node vector inside BRepGraph.
The pair (NodeKind, Index) forms a unique node identifier within one graph instance. Default-constructed NodeId has Index = UINT32_MAX (invalid).
NodeId is a value type: cheap to copy, compare, hash. It carries no pointer back to the owning graph; the caller is responsible for using it with the correct BRepGraph instance.

Constructors(2)

Static methods(5)

  • IsValidKind(theKind: BRepGraph_NodeId_Kind): boolean

    True if the kind value is one of the supported node kinds.

    Parameters (1)
    • theKind
  • IsTopologyKind(theKind: BRepGraph_NodeId_Kind): boolean

    True if the kind is a core topology kind (Solid..CoEdge).

    Parameters (1)
    • theKind
  • IsAssemblyKind(theKind: BRepGraph_NodeId_Kind): boolean

    True if the kind is an assembly kind (Product or Occurrence).

    Parameters (1)
    • theKind
  • Start(theKind: BRepGraph_NodeId_Kind): BRepGraph_NodeId

    First valid id in a dense sequence for the specified kind.

    Parameters (1)
    • theKind
  • Invalid(theKind?: BRepGraph_NodeId_Kind): BRepGraph_NodeId

    Invalid sentinel id for the specified kind.

    Parameters (1)
    • theKind

Instance methods(4)

  • IsValid(): boolean

    True if this id points to an allocated node slot.

  • IsValid(theMaxCount: number): boolean

    True if this id points to an allocated slot within [0, theMaxCount). UINT32_MAX (invalid sentinel) always fails this check for any realistic count.

    Parameters (1)
    • theMaxCount
  • IsRemoved(theGraph: BRepGraph): boolean

    Return true if this node has been soft-removed in the given graph.

    Parameters (1)
    • theGraph
  • IsOwned(theGraph: BRepGraph): boolean

    Return true if this node has an active owner in the given graph.

    Parameters (1)
    • theGraph

Properties(2)

BRepGraph_OccurrenceId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_OccurrenceRefId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_OccurrencesOfChild

Constructors(2)

Instance methods(9)

BRepGraph_ParallelPolicy

Lightweight workload-aware policy for deciding whether an internal phase should actually launch parallel work when parallel mode is allowed.
The goal is to avoid forcing every short-lived loop onto the thread pool. Decisions are based on available worker capacity and on the amount of work already visible to the phase, instead of on buried per-loop split sizes.

Constructors(1)

Static methods(4)

  • WorkerCount(): number

    Return the effective logical worker count reported by OSD_Parallel.

  • IsParallelAllowed(theAllowParallel: boolean): boolean

    Check whether parallel execution is allowed and meaningful at all.

    Parameters (1)
    • theAllowParallel
  • ShouldRun(theAllowParallel: boolean, theWorkers: number, theWorkload: BRepGraph_ParallelPolicy_Workload): boolean

    Decide whether the estimated workload is large enough to amortize thread-pool launch and synchronization overhead.

    Parameters (3)
    • theAllowParallel
      whether parallel mode is allowed by the caller
    • theWorkers
      effective logical worker count
    • theWorkload
      estimated workload for the phase
    Returns

    true if parallel execution should be used

  • ShouldRun(theAllowParallel: boolean, theWorkload: BRepGraph_ParallelPolicy_Workload): boolean

    Overload that queries the active worker count lazily.

    Parameters (2)
    • theAllowParallel
      whether parallel mode is allowed by the caller
    • theWorkload
      estimated workload for the phase
    Returns

    true if parallel execution should be used

BRepGraph_ParentExplorer

Upward occurrence-aware parent traversal for BRepGraph.
Enumerates all ancestor nodes reachable from a starting node. Traversal is path-aware: when the same definition is reached through multiple occurrence paths, each path contributes its own parent sequence with its own accumulated location and orientation.
The traversal follows the actual graph structure transparently - every node kind is visited as a distinct entity (no hidden collapses): Vertex -> Edge, Edge -> CoEdge, CoEdge -> Wire, Wire -> Face, Face -> Shell, Shell -> Solid, Solid -> CompSolid/Compound, topology root -> Occurrence, Product child -> Occurrence, Occurrence -> parent Product.
Traversal modes

  • Recursive: walks the full ancestor chain to the graph roots. Without target kind, all ancestors are emitted. With target kind, only matching ancestors are emitted but intermediate levels are traversed to reach them.
  • DirectParents: yields only the immediate parents of the starting node. No ascent into grandparents. With target kind, only parents matching the kind are returned.

Constructors(7)

  • Explore all parents of the starting node.

    Parameters (2)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
  • constructor(theGraph: BRepGraph, theNode: BRepGraph_NodeId, theConfig: BRepGraph_ParentExplorer_Config): BRepGraph_ParentExplorer

    Preferred long-term constructor: all tuning knobs in Config.

    Parameters (3)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theConfig
      traversal configuration
  • constructor(theGraph: BRepGraph, theNode: BRepGraph_NodeId, theMode: BRepGraph_ParentExplorer_TraversalMode): BRepGraph_ParentExplorer

    Explore parents of the starting node using the given traversal mode.

    Parameters (3)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theMode
      traversal strategy (recursive or direct parents)
  • constructor(theGraph: BRepGraph, theNode: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind): BRepGraph_ParentExplorer

    Explore only parents of the given kind.

    Parameters (3)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theTargetKind
      kind of nodes to emit
  • constructor(theGraph: BRepGraph, theNode: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind, theMode: BRepGraph_ParentExplorer_TraversalMode): BRepGraph_ParentExplorer

    Explore only parents of the given kind using the given traversal mode.

    Parameters (4)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theTargetKind
      kind of nodes to emit
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theNode: BRepGraph_NodeId, theAvoidKind: BRepGraph_NodeId_Kind | null | undefined, theEmitAvoidKind: boolean, theMode?: BRepGraph_ParentExplorer_TraversalMode): BRepGraph_ParentExplorer

    Explore all parents while pruning branches at the avoid kind.

    Parameters (5)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theAvoidKind
      node kind to avoid ascending through
    • theEmitAvoidKind
      if true, emit matching avoid-kind ancestors once
    • theMode
      traversal strategy
  • constructor(theGraph: BRepGraph, theNode: BRepGraph_NodeId, theTargetKind: BRepGraph_NodeId_Kind, theAvoidKind: BRepGraph_NodeId_Kind | null | undefined, theEmitAvoidKind: boolean, theMode?: BRepGraph_ParentExplorer_TraversalMode): BRepGraph_ParentExplorer

    Explore parents of the given kind while pruning branches at the avoid kind.

    Parameters (6)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theTargetKind
      kind of nodes to emit
    • theAvoidKind
      node kind to avoid ascending through
    • theEmitAvoidKind
      if true, emit matching avoid-kind ancestors once
    • theMode
      traversal strategy

Instance methods(11)

  • GetConfig(): BRepGraph_ParentExplorer_Config

    Returns the traversal configuration this explorer was constructed with. Read-only - configuration is fixed for the lifetime of the explorer.

  • More(): boolean

    True if another matching parent is available.

  • Next(): void

    Advance to the next matching parent.

  • Current(): any

    Current matching ancestor node with accumulated location and orientation.

  • Returns the immediate child of Current() on the currently emitted branch. Returns invalid NodeId when no current ancestor is available.

  • CurrentLinkKind(): BRepGraph_ParentExplorer_LinkKind

    Returns how Current() is linked to CurrentChild().

  • Returns the exact parent-owned RefId linking Current() to CurrentChild(), when that branch step is represented by a reference entry.
    Some upward steps are structural and therefore have no parent-owned ref entry even though the parent itself is still emitted by the explorer. In those cases this method returns an invalid RefId, for example for CoEdge->Edge and Occurrence->Product/topology-root.

  • Accumulated location at the starting node of the current branch.

  • Accumulated orientation at the starting node of the current branch.

  • True if Current() is the explicit root node of the current branch.

  • Returns a sentinel marking the end of iteration.

BRepGraph_ProductId

Constructors(3)

Static methods(3)

Instance methods(4)

Properties(1)

BRepGraph_ProductsOfOccurrence

Constructors(2)

Instance methods(9)

BRepGraph_RefId

Lightweight typed index into a per-kind reference vector inside BRepGraph.
The pair (Kind, Index) forms a unique reference identifier within one graph instance. Default-constructed RefId has Index = UINT32_MAX (invalid).

Constructors(2)

Static methods(4)

  • IsValidKind(theKind: BRepGraph_RefId_Kind): boolean

    True if the kind value is one of the supported reference kinds.

    Parameters (1)
    • theKind
  • IsTopologyRefKind(theKind: BRepGraph_RefId_Kind): boolean
    Parameters (1)
    • theKind
  • Start(theKind: BRepGraph_RefId_Kind): BRepGraph_RefId

    First valid id in a dense sequence for the specified kind.

    Parameters (1)
    • theKind
  • Invalid(theKind?: BRepGraph_RefId_Kind): BRepGraph_RefId

    Invalid sentinel id for the specified kind.

    Parameters (1)
    • theKind

Instance methods(4)

  • IsValid(): boolean
  • IsValid(theMaxCount: number): boolean

    True if this id points to an allocated slot within [0, theMaxCount). UINT32_MAX (invalid sentinel) always fails this check for any realistic count.

    Parameters (1)
    • theMaxCount
  • IsRemoved(theGraph: BRepGraph): boolean

    Return true if this reference entry has been soft-removed in the given graph.

    Parameters (1)
    • theGraph
  • IsOwned(theGraph: BRepGraph): boolean

    Return true if this reference entry has an active owner in the given graph.

    Parameters (1)
    • theGraph

Properties(2)