Will the node IDs always be the same between loads of the viewer?

Yes, but loading multiple models in the same scene requires accounting for a shift in node IDs.

Here’s how to do this: After you’ve loaded your first model, you’ll want to keep track of the shift before loading a new model. These two lines show how to capture the shift amount from the viewer:

const model = hwv.model;

const nodeOffset = model.getLowestAvailableNodeId();

Now anywhere you need the persistent node ID you would do something like this:

const id = selection.getNodeId() - nodeOffset;

This will always allow you to get back to the persistent ID for retrieving associated application level data.

For more information, see the Assembly Tree Node IDs page.