How to change or load a new model after _viewer.start() in HOOPS Communicator?

Hi,

I’m initializing my viewer like this:

let params = {
  containerId: containerId,
  streamMode: window.Communicator.StreamingMode.All,
  rendererType: window.Communicator.RendererType.Client,
  streamCutoffScale: streamCutoffScale,
  endpointUri: uri,
  boundingPreviewMode: Communicator.BoundingPreviewMode.None,
  model: fileName
};

let _viewer = new window.Communicator.WebViewer(params);
_viewer.start();

Once the viewer has started, I’d like to change the model dynamically — for example, load another .scz file or switch to a different model on the same streaming webSocket connection server.

What’s the correct way to load or replace the model after _viewer.start() has been called?
is there any recommended method for switching models while keeping the same viewer instance active?

Any example or best practice guidance would be appreciated.

@raja.r,

I think your best bet is to clear the model and then load the new one, for example:

await hwv.model.clear();
await hwv.model.loadSubtreeFromModel(hwv.model.getAbsoluteRootNode(), "name_of_model");

Thanks,
Tino