Warning

Nightly releases are generated automatically from the latest source code and are intended for experimental purposes only. These builds may contain incomplete or untested features, bugs, or security vulnerabilities, and as such, are not for production use. Users should be aware that nightly releases may cause unexpected behavior, data loss, or system instability. Use of these releases is at the user's own risk, and it is advised to have adequate backups before testing. The software is provided as is with no guarantees or support.

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 = webvis.getContext( "example" )

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

// the model is currently loading in the browser and we know, that the parts which are of interest have the nodeIDds 170 and 171
// we execute the following code in the console to get a string that can be used to refer to the part everytime
const handles = await myContext.createNodePathHandles([170, 171]);
const nodePathStrings = await myContext.requestNodePathStrings(handles);

// Afterwards the nodePathStrings can be used to retrieve the runtime nodeIDs by script
const nodePathHandleMap = await myContext.requestNodePathHandleMap(nodePathStrings);
for (const nodePathString of nodePathStrings) {
    console.log(nodePathString + " has the nodeID " + nodePathHandleMap[nodePathString].nodeID);
}
interface NodePathAPI {
    createNodePathHandles(targets: number[]): Promise<NodePathHandle[]>;
    requestNodePathHandleMap(
        paths: string[],
        scope?: number,
    ): Promise<NodePathHandleMap>;
    requestNodePathStrings(
        handles: NodePathHandle[],
        scope?: number,
        typePriorities?: NodePathFragmentType[],
    ): Promise<string[]>;
}

Hierarchy (View Summary)

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.

    • Optionalscope: 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}

    • Optionalscope: number

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

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