问题描述
我目前正在一家BIM专业公司实习.到目前为止,我的任务是实现适用于聚合和显示多个模型的Forge Autodesk查看器.我已经设法编写了一个工作的查看器,并找到了一种汇总模型的方法,但是我不明白如何使它们协同工作.
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.
在Forge Autodesk教程之后,我已经实现了查看器,并在Forge Autodesk博客上找到了一篇文章,内容涉及使用要集成到查看器中的代码查看多个模型,目前未成功.
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.
我实现的查看器: http://learnforge.autodesk.io/#/
显示聚合模型的假定方式: https://forge .autodesk.com/blog/supporting-multiple-models-new-modelstructurepanel
The supposed way to display aggregated models : https://forge.autodesk.com/blog/supporting-multiple-models-new-modelstructurepanel
我应该能够在同一查看器中选择并显示多个已加载的模型(例如,建筑物的模型和管网的模型).但是,我不知道该脚本如何添加到我的查看器中.我已经尝试与作者联系,但是他回答说他不再使用Autodesk,并告诉我就我的问题向Forge支持.
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.
提前谢谢!
推荐答案
用简单的术语概括模型,就需要分别加载它们:
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
如Philipe的文章中所述,与多个模型一起使用时,您需要订阅不同的事件,而不是像AGGREGATE_SELECTION_CHANGED_EVENT
,Autodesk.Viewing.AGGREGATE_ISOLATION_CHANGED_EVENT
,Autodesk.Viewing.AGGREGATE_FIT_TO_VIEW_EVENT
等单个模型.
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.
从Viewer v6开始,内置的model browser
处理多个模型要好得多,并且几乎涵盖了本文中描述的功能-您可以查看其中的代码示例并提出自己的扩展:
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:
这篇关于如何实现Forge Autodesk模型汇总查看器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!