NodePathAPI#

Interface NodePathAPI

NodeIDs are generated during runtime. There is no guarantee, that the nodeIDs of a loaded model are the same, if the 3D Space was reloaded in the browser.

The NodePathAPI allows the user to handle nodes with static identifiers, which are not changed during runtime. This holds, if the model resource is not changed.

Example

// Get an instance of the ContextAPI
const myContext : ContextAPI = webvis.getContext( "example" )

// add some Model
myContext.add(someModelURI);

// the model is currently loading in the browser and we know, that the part which is of interest has the nodeID 170
// we execute the following code in the console to get a string that can be used to refer to the part everytime
const handle = await webvis.createNodePathHandles([170]);
const nodePathString = await webvis.requestNodePathStrings(handle);

// Afterwards the nodePathString can be used to retrieve the runtime nodeID by script
const currentNodeID = (await myContext.requestNodePathHandleMap([ nodePathString ]))[nodePathString].nodeID;

Hierarchy

Methods

  • createNodePathHandles Creates and returns handles for the target node ids or topology selectors.

    Parameters

    • targets: number[]

      {Array} Array of target node ids to create the handles for

    Returns Promise<NodePathHandle[]>

    The array of handles

  • requestNodePathHandleMap Returns an object mapping from input paths to the respective handles.

    Parameters

    • paths: string[]

      {Array<string | NodePathHandle>} The array of node path strings or handles.

    • Optional scope: number

      {number} [scope=0] nodeID specifying the scope as starting point for the paths

    Returns Promise<NodePathHandleMap>

    The resulting object mapping paths to handles

  • requestNodePathStrings Returns string representations for the respective node path handles.

    Parameters

    • handles: NodePathHandle[]

      {Array}

    • Optional scope: number

      {number} nodeID specifying the scope as starting point for the path resolution

    • Optional typePriorities: NodePathFragmentType[]

      {Array} Array of priorities to control the fragments for the path string assembly.

    Returns Promise<string[]>

    String representation of the node path for the respective scope.


Did you find this page useful? Please give it a rating:
Thank you for rating this page!
Any issues or feedback?
What kind of problem would you like to report?
Please tell us more about what's wrong: