Skip to main content
Version: 4.x

Node visitor functions

Reveal has functions for iterating over CAD nodes, either all nodes in a 3D model or a subtree of a parent node. Note that all functions are async, and the action that you pass is not applied immediately. A single model can have millions of nodes. To avoid long blocking operations the action is applied in blocks, allowing for an interactive page while the action is being applied.

Iterate over all nodes

This example only demonstrates how iteration over model nodes performed gradually.

Live Editor

Iterate over subtree nodes

CogniteCadModel.iterateSubtreeByTreeIndex iterates over all descendants of a node by tree index. The provided tree index is included in the set of visited nodes. The following example sets the color of all descendants of a node. This mimics the functionality of CogniteCadModel.setNodesColorsByTreeIndex with applyToChildren set to true.

Live Editor