OpenCascade.js
API ReferenceModelingDataTKBRepBRepGraph

BRepGraph

OCCT package BRepGraph: BRepGraph, BRepGraph_Builder, BRepGraph_CacheKind, BRepGraph_CacheKindRegistry, and 180 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, O(1) upward navigation via reverse indices, 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: BRepGraph_Builder::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. BRepGraph_Builder::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 (per-node attributes) or BRepGraph_TransientCache (algorithm-computed caches). 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 geometry/mesh representation objects (Surface, Curve3D, Curve2D, Triangulation, Polygon) independently of topology nodes.
    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, coedge refs 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 reverse indices 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.
  • BRepGraph_WireExplorer: ordered edge traversal within a single wire, following connectivity order (graph equivalent of BRepTools_WireExplorer).

Constructors(2)

Instance methods(15)

  • Clear(): void

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

  • IsDone(): boolean

    Return true if the graph was successfully built.

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

    Returns

    true when every forward ref has a matching reverse entry.

  • 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.

  • Replace the internal allocator and re-create all storage.

    Parameters (1)
    • theAlloc
  • Return the current allocator.

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

  • Access unique identifiers.

  • Access transient cache values through the stable grouped-view API. This is the only public cache interface.

  • Access reference entries and their UIDs.

  • Access cached and fresh shape reconstruction.

  • Access programmatic graph construction and mutation.

  • Access mesh data with cache-first, persistent-fallback priority. For mesh cache writes and rep creation, use BRepGraph_Tool::Mesh.

  • Access history subsystem directly. History is returned directly rather than through a lightweight view because it is already a self-contained query and recording subsystem with no per-view cached state.

    Returns

    history subsystem for tracking modifications

  • Access registered graph layers.

    Returns

    layer registry for managing attribute layers

BRepGraph_Builder

Static helper that ingests a TopoDS_Shape into a BRepGraph.

Static methods(4)

  • Add(theGraph: BRepGraph, theShape: TopoDS_Shape): BRepGraph_Builder_Result

    Ingest a TopoDS_Shape as a new root subgraph, wrapping the topology root in a Product.

    Parameters (2)
    • theGraph
      graph to populate
    • theShape
      shape to ingest
    Returns

    Result with TopologyRoot, Product and Occurrence set on success.

  • Add(theGraph: BRepGraph, theShape: TopoDS_Shape, theOptions: BRepGraph_Builder_Options): BRepGraph_Builder_Result

    Ingest a TopoDS_Shape as a new root subgraph with explicit options.

    Parameters (3)
    • theGraph
      graph to populate
    • theShape
      shape to ingest
    • theOptions
      build-time options
    Returns

    Result with TopologyRoot set on success; Product/Occurrence set when theOptions.CreateAutoProduct is true.

  • Add(theGraph: BRepGraph, theShape: TopoDS_Shape, theParent: BRepGraph_NodeId): BRepGraph_Builder_Result

    Ingest a TopoDS_Shape under an existing parent.
    Parent kind dispatch:

    • Product: creates a child part-product, links via Occurrence with shape.Location().
    • Compound: appends topology root as a child reference.
    • Shell: appends a Face as a FaceRef; other shapes via AddChild.
    • Solid: appends a Shell as a ShellRef; other shapes via AddChild.
    • CompSolid: appends a Solid as a SolidRef. Other parent kinds (Wire, Edge, Vertex, Occurrence) are not supported and yield an invalid Result (Result::Ok == false) without modification to the graph.
    Parameters (3)
    • theGraph
      graph to populate
    • theShape
      shape to ingest
    • theParent
      parent node receiving the topology
    Returns

    Result with TopologyRoot set, plus (Product, Occurrence, InsertedRef) for Product parents or InsertedRef for topology container parents.

  • Add(theGraph: BRepGraph, theShape: TopoDS_Shape, theParent: BRepGraph_NodeId, theOptions: BRepGraph_Builder_Options): BRepGraph_Builder_Result

    Ingest a shape under an existing parent with explicit options. Options::CreateAutoProduct is ignored.

    Parameters (4)
    • theGraph
    • theShape
    • theParent
    • theOptions

BRepGraph_CacheKind

Descriptor of one transient cache family.
A cache kind defines stable public identity for one class of transient, recomputable per-node data such as bounding boxes or UV bounds. Instances are process-global descriptors registered in BRepGraph_CacheKindRegistry and referenced from graphs by dense runtime slots.

Constructors(1)

Static methods(3)

Instance methods(5)

BRepGraph_CacheKindRegistry

Process-global registry of cache kind descriptors.
Maps stable GUID identity to dense runtime slot index. Slot indices are an internal storage detail used by BRepGraph_TransientCache for O(1) indexing. The registry is shared across all BRepGraph instances in the current process, so cache-kind GUIDs should be globally unique.

Static methods(8)

  • Register(theKind: BRepGraph_CacheKind): number

    Register a cache kind descriptor. Idempotent: the same GUID always yields the same slot. Slot assignment is process-global and graph-instance independent.

    Parameters (1)
    • theKind
    Returns

    dense runtime slot, or -1 for null input

  • FindSlot(theGUID: Standard_GUID): number

    Find slot by GUID. Returns -1 if not found.

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

    Find slot by GUID.

    Parameters (2)
    • theGUID
    • theSlot
      dense runtime slot if found
    Returns

    A result object with fields:

    • returnValue: true if the GUID is registered
    • theSlot: dense runtime slot if found
  • Find descriptor by GUID.

    Parameters (1)
    • theGUID
  • FindKind(theSlot: number): BRepGraph_CacheKind

    Find descriptor by slot.

    Parameters (1)
    • theSlot
  • Contains(theGUID: Standard_GUID): boolean

    Check whether a GUID is registered.

    Parameters (1)
    • theGUID
  • Contains(theSlot: number): boolean

    Check whether a slot is registered.

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

    Number of registered cache kinds.

BRepGraph_CacheValue

Abstract base for transient per-node cache values.
Inherits from Standard_Transient and is stored via occ::handle<BRepGraph_CacheValue>. This uses OCCT's embedded refcount and is consistent with the Handle pattern used throughout the codebase.

Static methods(2)

Instance methods(3)

BRepGraph_CacheView

Instance methods(20)

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(assembly) -> Occurrences, Product(part) -> ShapeRoot, Occurrence -> Product.
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)

Instance methods(12)

  • 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
  • Next(): void
  • Current(): any
  • 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, Product(part)->ShapeRoot and Occurrence->Product.

  • LocationOf(theKind: BRepGraph_NodeId_Kind): TopLoc_Location
    Parameters (1)
    • theKind
  • NodeOf(theKind: BRepGraph_NodeId_Kind): BRepGraph_NodeId
    Parameters (1)
    • theKind
  • LocationAt(theLevel: number): TopLoc_Location
    Parameters (1)
    • theLevel
  • NodeAt(theLevel: number): BRepGraph_NodeId
    Parameters (1)
    • theLevel
  • Returns a sentinel marking the end of iteration.

BRepGraph_ChildRefId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_CoEdgeRefId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_CoEdgesOfEdge

Constructors(2)

Instance methods(10)

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_CompoundsOfCompSolid

Constructors(2)

Instance methods(10)

BRepGraph_CompSolidId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_CompSolidsOfSolid

Constructors(2)

Instance methods(10)

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 modes:

  • theCopyGeom = true (deep): geometry handles are cloned, result is fully independent.
  • theCopyGeom = false (light): geometry handles are shared, only topology is duplicated.
    Typical usage
BRepGraphaGraph; BRepGraph_Builder::Add(aGraph,myShape); BRepGraphaCopy=BRepGraph_Copy::Perform(aGraph); TopoDS_ShapeaShape=aCopy.Shapes().Shape();

Static methods(2)

  • Perform(theGraph: BRepGraph, theCopyGeom: boolean): BRepGraph

    Copy the entire graph.

    Parameters (2)
    • theGraph
      a pre-built BRepGraph (must have IsDone() == true)
    • theCopyGeom
      if true (default), geometry handles are deep-copied; if false, geometry is shared (only topology is duplicated)
    Returns

    a new BRepGraph with IsDone() == true on success, or an empty graph with IsDone() == false on failure

  • CopyNode(theGraph: BRepGraph, theNodeId: BRepGraph_NodeId, theCopyGeom: boolean, theCopyMesh: boolean, theReserveCache: boolean): BRepGraph

    Copy a single node sub-graph of any kind (Face, Shell, Solid, Wire, Edge, Vertex, etc.). The new graph contains only the specified node and all entities it references.

    Parameters (5)
    • theGraph
      a pre-built BRepGraph
    • theNodeId
      node identifier (any kind)
    • theCopyGeom
      if true, geometry handles are deep-copied
    • theCopyMesh
      if true, cached mesh entries are propagated to the result; if false, mesh references are dropped on copied faces
    • theReserveCache
      if true, pre-allocates transient cache
    Returns

    a new BRepGraph containing only the specified sub-graph

BRepGraph_Curve2DRepId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_Curve3DRepId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_Data

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

Constructors(2)

Properties(31)

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 reverse-index 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_ChildOfShellTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_ChildOfSolidTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_CoEdgeOfWireTraits

Constructors(1)

Static methods(5)

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_VertexOfFaceTraits

Constructors(1)

Static methods(5)

BRepGraph_DefsIterator_WireOfFaceTraits

Constructors(1)

Static methods(5)

BRepGraph_EdgesOfVertex

Constructors(2)

Instance methods(10)

BRepGraph_EditorView

Instance methods(18)

BRepGraph_FaceRefId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_FacesOfEdge

Constructors(2)

Instance methods(10)

BRepGraph_History

Extracted history subsystem for BRepGraph.
BRepGraph_History maintains an append-only log of modification events and bidirectional lookup maps (original <-> derived) for efficient history queries. Recording can be toggled on/off at runtime.

Constructors(1)

Instance methods(10)

  • Record a modification: theOriginal was replaced by theReplacements.

    Parameters (3)
    • theOpLabel
      human-readable operation name
    • theOriginal
      node id before the operation
    • theReplacements
      node ids after the operation
  • Record(theRecordIdx: number): BRepGraph_HistoryRecord

    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

  • Record a batch of 1-to-1 modifications in a single history event. theOriginals[i] was replaced by theReplacements[i]. More efficient than calling Record() in a loop: creates one HistoryRecord and updates the bidirectional maps with minimal overhead.

    Parameters (4)
    • 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
  • 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. Follows the forward map recursively, collecting all leaves.

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

    all transitively derived node ids

  • 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.

  • Set the allocator for internal containers. Must be called before any Record/RecordBatch calls.

    Parameters (1)
    • theAlloc
      allocator to use for internal maps

BRepGraph_HistoryRecord

One atomic modification event recorded in the graph's history log.
A HistoryRecord captures what happened during a single call to BRepGraph::ApplyModification():

  • OperationName identifies the algorithm ("Sewing", "FilletEdge", ...).
  • SequenceNumber provides total ordering of events.
  • Mapping records the topological fate of each affected node: original -> [replacement1, replacement2, ...] (split) original -> [same_node] (modified in place) original -> [] (deleted)
    The history log is append-only within a graph's lifetime.

Constructors(1)

Properties(4)

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

  • Layer type identity (unique within a graph).

  • Layer identity (unique within a graph).

  • OnNodeRemoved(theNode: BRepGraph_NodeId, theReplacement: BRepGraph_NodeId): void

    Called when a node is soft-removed.

    Parameters (2)
    • theNode
      the removed node
    • theReplacement
      if valid, the node that replaces theNode (e.g., sewing edge merge, deduplicate). If invalid, pure deletion. Layers should migrate data from theNode to theReplacement when valid, otherwise discard or archive removed-node data. Implementations must validate theReplacement before dereferencing graph data through it.
    Remarks

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

  • Called after Compact with a unified old->new remap map. Layer must remap all internal NodeId references using this map. The map covers all node kinds (Vertex through CompSolid and future extensions). Nodes absent from the map were removed during compaction - layers should drop data associated with those nodes.

    Parameters (1)
    • theRemapMap
      maps old NodeId to new NodeId for all surviving nodes
  • 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
  • Called after EndDeferredInvalidation() with all nodes modified during the deferred scope. Only dispatched if at least one modified node's kind matches SubscribedKinds(). The vector 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
  • OnRefsModified(theModifiedRefs: NCollection_DynamicArray_BRepGraph_RefId, theModifiedRefKindsMask: number): void

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

    Parameters (2)
    • theModifiedRefs
      all modified, non-removed refs
    • theModifiedRefKindsMask
      bitwise OR of all modified ref kinds
  • 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.

  • Owning graph, set by the registry on RegisterLayer() and cleared on Unregister(). Nullptr before registration or after unregistration.

  • Mutable accessor for layers that drive graph mutations (e.g. meshing).

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_LayerParam

Persistent vertex point-representation store: point-on-curve, point-on-surface, and point-on-PCurve parameters per vertex.
Mirrors classical BRep_PointRepresentation entries on TVertex: each vertex may carry parameters identifying its location on incident edges, faces, or coedges (PCurves). The layer is the single source of truth for these parameters in BRepGraph.
Lifetime policy
The layer is persistent metadata: stored values survive arbitrary mutations to the referenced vertices, edges, faces, and coedges. Only the following events discard data:

  • OnNodeRemoved - the referenced node is gone; entries naming it are dropped (or migrated when a replacement is provided).
  • OnCompact - ids are remapped; entries pointing to removed nodes drop.
  • InvalidateAll() / Clear() - explicit caller request. The layer does NOT subscribe to OnNodeModified: a tolerance bump, parameter range adjustment, or NaturalRestriction toggle on a referenced node leaves point-representation data intact. Callers that change geometry are responsible for refreshing affected entries.

Constructors(1)

Static methods(3)

Instance methods(18)

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

BRepGraph_LayerRegularity

Persistent edge-continuity store, keyed by (edge, F1, F2).
Each entry holds the geometric continuity (C^k / G^k) across the face pair at a given edge. F1 == F2 represents seam continuity across a closed surface's seam line; F1 != F2 represents inter-face regularity. The schema mirrors classical BRep_Tool::Continuity(edge, F1, F2).
Lifetime policy
The layer is persistent metadata: stored values survive arbitrary mutations to the referenced edges and faces. Only the following events discard data:

  • OnNodeRemoved(edge|face) - the referenced node is gone; entries naming it are dropped (or migrated when a replacement is provided).
  • OnCompact - ids are remapped; entries pointing to removed nodes drop.
  • InvalidateAll() / Clear() - explicit caller request. In particular, this layer does NOT subscribe to OnNodeModified: a tolerance bump or NaturalRestriction toggle leaves stored continuity intact. Callers that change the underlying geometry are responsible for refreshing affected entries (typically via SetRegularity, removeRegularity, or InvalidateAll).

Constructors(1)

Static methods(3)

Instance methods(15)

BRepGraph_MeshCacheStorage

Storage backend for cached mesh data.
Dense vectors indexed by per-kind entity index (same pattern as DefStore). Entries with StoredOwnGen == 0 are absent (no cached mesh data). Thread safety: parallel writes to different indices are safe (no contention).

Constructors(1)

Instance methods(14)

BRepGraph_MeshView_PolyOps

Instance methods(12)

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

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

  • 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

Properties(2)

BRepGraph_OccurrenceId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_OccurrenceRefId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_OccurrencesOfProduct

Constructors(2)

Instance methods(10)

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
    • theWorkers
    • theWorkload
  • ShouldRun(theAllowParallel: boolean, theWorkload: BRepGraph_ParallelPolicy_Workload): boolean

    Overload that queries the active worker count lazily.

    Parameters (2)
    • theAllowParallel
    • theWorkload

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, Product -> Occurrence, Occurrence -> Product (parent assembly).
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
    • theNode
  • 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

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

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

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

    Parameters (3)
    • theGraph
      graph to walk
    • theNode
      starting node whose ancestors are explored
    • theTargetKind
  • 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
    • theNode
    • theTargetKind
    • theMode
  • 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
    • theNode
    • theAvoidKind
    • theEmitAvoidKind
    • theMode
  • 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
    • theNode
    • theTargetKind
    • theAvoidKind
    • theEmitAvoidKind
    • theMode

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, Product(part)->ShapeRoot and Occurrence->Product.

  • 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_Polygon2DRepId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_Polygon3DRepId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

BRepGraph_PolygonOnTriRepId

Constructors(3)

Static methods(3)

Instance methods(2)

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

Properties(1)

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

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

  • 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

Properties(2)

BRepGraph_RefsIterator_ChildOfCompoundTraits

Constructors(1)

Static methods(4)

BRepGraph_RefsIterator_ChildOfShellTraits

Constructors(1)

Static methods(4)

BRepGraph_RefsIterator_ChildOfSolidTraits

Constructors(1)

Static methods(4)