Search code examples
autodesk-forgeautodesk-viewer

keepCurrentModels option for AggregatedView


I'm trying to load multiple models, following the steps described in this article: https://forge.autodesk.com/blog/loading-multiple-models-forge-viewer-v7

If you don't use the new AggregatedView class, you can use the option keepCurrentModels: true during viewer.loadDocumentNode(...) as described in the article.

However, when using the AggregatedView, I haven't been able to keep the already loaded models. This is because you don't load models using loadDocumentNode(...).

I use the code provided in the sample on the site (https://gist.github.com/yiskang/c404af571ba4d631b5929c777503891e). How do I modify this code so I can load models after I already loaded initial models?


Solution

  • Just call AggregatedView#show( bubble ) for other models you want to load after initials. The AggregatedView#show will apply the option keepCurrentModels: true while loading the new model according to the current design. On the contrary, to unload loaded models, call AggregatedView#hide( bubble ).