I am creating a site with a forge-viewer and want to view multiple loaded models in a single window. How can I enable the function of loading and viewing several models in one place?
This is for a new site. I have already tried all the methods and recommendations available on the Internet,but none of them helped me solve my problem.
My code is fully consistent with the code from this source https://github.com/Autodesk-Forge/learn.forge.viewmodels/tree/nodejs
I expect that I can finally add the function of loading and viewing several models in one window, but so far I did not manage to do it.
Advertisement
Answer
Read up on this and this series of blogs for a pretty thorough walkthrough on model aggregation with Viewer.
In a nutshell you will need to load different models using viewer.start for the first model and then viewer.loadModel for the others:
this.viewer.start(svfUrl, loadOptions, onLoadModelSuccess, onLoadModelError); this.viewer.loadModel(svfUrl, loadOptions, onLoadModelSuccess, onLoadModelError);
See doc for this method here.