# Loading Multiple Streaming Models in the Same Scene Using Hoops Communicator

**URL:** <https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318>\
**Category:** HOOPS Visualize Web\
**Tags:** code, sample, webviewer\
**Created:** [January 9, 2025, 4:45pm UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318 "2025-01-09T16:45:59Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![raja.r](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@raja.r](https://forum.techsoft3d.com/u/raja.r)\
**Post date:** [January 9, 2025, 4:45pm UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/1 "2025-01-09T16:45:59Z")

</div>

Hello Team,

I am currently working with Hoops Communicator and have successfully loaded a primary model (`model1.scz`) into the scene using the `WebViewer` as follows:

javascript

Copy code

```auto
let params = {
    containerId: "divId",
    streamMode: window.Communicator.StreamingMode.All,
    rendererType: window.Communicator.RendererType.Client,
    streamCutoffScale: streamCutoffScale,
    endpointUri: uri,
    boundingPreviewMode: Communicator.BoundingPreviewMode.None,
    model: 'model1.scz'
};

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

```

I would like to load an additional model (`model2.scz`) into the same scene without replacing the primary model. Could you guide me on the best way to achieve this?

My Trials:

```auto
const root = this.viewer.model.createNode(rootNodeId, "combineModel");
await this.model.loadSubtreeFromModel(root, 'model2.scz');

```

Error: Missing model: ‘model2.scz’.

(Note: but the endpoint url for both the models are not same)

Thank you in advance for your assistance!

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [January 9, 2025, 9:10pm UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/2 "2025-01-09T21:10:36Z")

</div>

Hello @raja.r,

We would expect your call to load the second model (_model2.scz_) to succeed provided that the model is accessible and configured as such in the server. For example, if the second model is in the same directory as the first model (_model1.scz_), it should load in the viewer.

Can you please confirm that this is the case?

Thanks,  
Tino

---

<div class="post-metadata">

**Author:** ![nivedita.srivastava](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nivedita.srivastava](https://forum.techsoft3d.com/u/nivedita.srivastava)\
**Post date:** [April 10, 2025, 4:08am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/3 "2025-04-10T04:08:09Z")

</div>

hello I am trying to load multiple scz files from my xml. Is there any method to load them as my current method is not able to load them.

code–\> if (filePath) {  
const modelName = filePath.slice(0, -4);  
hwv.model.loadSubtreeFromModel(  
nodeId,  
`${modelName}`  
);  
}

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [April 10, 2025, 4:51am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/4 "2025-04-10T04:51:21Z")

</div>

Hello @nivedita.srivastava,

It looks like you are taking the substring of `filepath` as the model name to load. Provided that the model name is correct and the directory to that model is properly set up in the server configuration, your call to `loadSubtreeFromModel` should work.

Are you getting any errors in the web browser console?

Thanks,  
Tino

---

<div class="post-metadata">

**Author:** ![nivedita.srivastava](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nivedita.srivastava](https://forum.techsoft3d.com/u/nivedita.srivastava)\
**Post date:** [April 10, 2025, 4:57am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/5 "2025-04-10T04:57:47Z")

</div>

hello, thank u for replying. This is the error I am getting-

 ![image](https://us1.discourse-cdn.com/flex020/uploads/techsoft3d/original/2X/a/a3d2d62739faa30c299e37a19c7963aaa9e15aab.png)

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [April 10, 2025, 5:09am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/6 "2025-04-10T05:09:53Z")

</div>

The exception `Incompatible load types` indicates that you are loading a Stream Cache model into an existing _non-streaming session_ designed for loading SCS files. You can do one of the following options:

- Call the function `loadSubtreeFromScsFile` instead of `loadSubtreeFromModel`, for example, `hwv.model.loadSubtreeFromScsFile(nodeId, "modelName.scs");`
- OR launch a streaming session in the Web Viewer so that you can still use `loadSubtreeFromModel`

---

<div class="post-metadata">

**Author:** ![nivedita.srivastava](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nivedita.srivastava](https://forum.techsoft3d.com/u/nivedita.srivastava)\
**Post date:** [April 10, 2025, 5:13am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/7 "2025-04-10T05:13:13Z")

</div>

I am already launching a streaming session throught web socket and using node server to render the model and I want to load scz files.

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [April 10, 2025, 5:25am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/8 "2025-04-10T05:25:26Z")

</div>

To clarify, in this context, streaming session refers to the file being used. SCS files are file-based whereas regular SC/SCZ are streaming formats.

In the web browser dev console, what are you getting when you run the following:  
`console.log(JSON.stringify(hwv.config));`

---

<div class="post-metadata">

**Author:** ![nivedita.srivastava](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nivedita.srivastava](https://forum.techsoft3d.com/u/nivedita.srivastava)\
**Post date:** [April 10, 2025, 5:47am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/9 "2025-04-10T05:47:52Z")

</div>

{“containerId”:“viewer”,“endpointUri”:“ws://127.0.0.1:11182”,“streamingMode”:1,“rendererType”:0}

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [April 10, 2025, 6:11am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/10 "2025-04-10T06:11:14Z")

</div>

Thanks for providing the info.

Given that `endpointUri` is not a SCS, your session streaming based. What is the complete value assigned to the variable `modelName` in your code snippet?

---

<div class="post-metadata">

**Author:** ![fthiel](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@fthiel](https://forum.techsoft3d.com/u/fthiel)\
**Post date:** [May 1, 2025, 2:48pm UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/11 "2025-05-01T14:48:17Z")

</div>

Apologies for reviving this thread, but I had a similar issue and wanted to share how I solved it.

I am getting the same error and config as @nivedita.srivastava when I create the WebViewer without passing a model name in. However, if I pass a model name in (i.e. load a streaming model when WebViewer is created) I can use loadSubtreeFromModel().

It appears to me that if the WebViewer is not created with a model, the streaming setting does not take hold properly even though streamingMode is set.

This example does not work:

```auto
    window.onload = function () {        
        let server = new ServerConnection("http://localhost:11182");
        server.connect().then(async function () {
            const hwv = new Communicator.WebViewer({
                containerId: "myContainer",
                enginePath: "./",
                endpointUri: server._endpointuri
            });

            hwv.setCallbacks({
                modelStructureReady: () => {
                    var rootid = hwv.model.getAbsoluteRootNode();
                    var nodeid = hwv.model.createNode(rootid, "Another Model");
                    hwv.model.loadSubtreeFromModel(nodeid, "anotherModel");
                }
            })

            await hwv.start();
        })
    }

```

But this does:

```auto
    window.onload = function () {        
        let server = new ServerConnection("http://localhost:11182");
        server.connect().then(async function () {
            const hwv = new Communicator.WebViewer({
                containerId: "myContainer",
                enginePath: "./",
                endpointUri: server._endpointuri,
                model: "FirstModel" // Only change, added a model at start
            });

            hwv.setCallbacks({
                modelStructureReady: () => {
                    var rootid = hwv.model.getAbsoluteRootNode();
                    var nodeid = hwv.model.createNode(rootid, "Another Model");
                    hwv.model.loadSubtreeFromModel(nodeid, "anotherModel");
                }
            })

            await hwv.start();
        })
    }

```

---

<div class="post-metadata">

**Author:** ![tino](https://avatars.discourse-cdn.com/v4/letter/t/9dc877/32.png) [@tino](https://forum.techsoft3d.com/u/tino)\
**Post date:** [May 21, 2025, 8:53am UTC](https://forum.techsoft3d.com/t/loading-multiple-streaming-models-in-the-same-scene-using-hoops-communicator/4318/12 "2025-05-21T08:53:24Z")

</div>

If you want to start the Web Viewer without a model, there is a specific WebViewerConfig option for this called [WebViewerConfig.empty](https://docs.techsoft3d.com/communicator/latest/api_ref/viewing/interfaces/WebViewerConfig.html#WebViewerConfig.empty).
