How to implement a Forge Autodesk model-aggregatin

2019-08-18 07:47发布

I'm currently doing an internship in a company specialized in BIM. My mission so far consists in implementing a Forge Autodesk viewer, suited for the aggregation and the display of multiple models. I've managed to code a working viewer, and to find a supposed way to aggregate models, but I can't understand how to make them work together.

I've already implemented a viewer, following the Forge Autodesk tutorial, and found on the Forge Autodesk blog an article about viewing multiple models with a code I'm trying to integrate to my viewer, at this point unsuccessfully.

The viewer I implemented : http://learnforge.autodesk.io/#/

The supposed way to display aggregated models : https://forge.autodesk.com/blog/supporting-multiple-models-new-modelstructurepanel

I should be able to select and display several loaded models in the same viewer (for example a model for a building and a model for the pipe network). However, I can't figure out how this script has to be added to my viewer. I've already tried to contact the author, but he answered me he was not working with Autodesk anymore, and told me to ask the Forge support about my issue.

Thanks in advance !

1条回答
叼着烟拽天下
2楼-- · 2019-08-18 08:34

Basically in simpler terms to aggregate models one will need to load them respectively:

viewer.start(model1URL, options); //first model
...
viewer.loadModel(model2URL, options) //second model
... //more models

See a simple live sample here

As was mentioned in Philipe's article you will need to subscribe to different events as opposed to single model like AGGREGATE_SELECTION_CHANGED_EVENT, Autodesk.Viewing.AGGREGATE_ISOLATION_CHANGED_EVENT, Autodesk.Viewing.AGGREGATE_FIT_TO_VIEW_EVENT etc when working with multiple models.

And starting from Viewer v6 the built-in model browser deals a lot better with multiple models and almost covers the functionality described in the article - you can look into the code sample there and come up with your own extension: enter image description here

查看更多
登录 后发表回答