使用Forge-Viewer库查询属性而无需渲染模型
我正在使用Forge-Viewer库显示模型。我想知道是否可以在同一时间从另一个模型查询属性,而无需渲染其他模型或更改原始查看器实例的状态?
最好通过获得Autodesk.viewing.model的新实例,以便使用model.getProperties(...)
之类的方法。
使用原始查看器实例加载会导致其他模型显示在浏览器中
const document: Autodesk.Viewing.Document = await myLoadDocumentFunction("urn:another-model-urn");
const defaultModel = document.getRoot().getDefaultGeometry();
const model = await viewer.loadDocumentNode(document, defaultModel);
I'm using the forge-viewer library to display models. I'm wondering if it is possible to at the same time query properties from another model, without rendering the other model or altering the state of the original viewer instance?
Preferably by obtaining a new instance of Autodesk.Viewing.Model, in order to use methods like model.getProperties(...)
.
Loading with the original viewer instance causes the other model to display in the browser
const document: Autodesk.Viewing.Document = await myLoadDocumentFunction("urn:another-model-urn");
const defaultModel = document.getRoot().getDefaultGeometry();
const model = await viewer.loadDocumentNode(document, defaultModel);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如文档所述, loaddocumentNode()传递到 loadModel()因此您可以检查该功能的文档以查看什么可以使用选项。
其中之一是
loadAshdide
,它似乎完全可以做您需要的事情:仅供参考:还应该可以创建另一个
viewer
实例,使其变得不可见(例如将其放在屏幕上),并在此处加载额外的模型: autodesk forge查看器的多个实例As the documentation states, the
options
input variable for loadDocumentNode() is passed on to loadModel() so you can check the documentation of that function to see what options are available.One of them is
loadAsHidden
which seems to do exactly what you need:FYI: it should also be possible to create another
Viewer
instance, make it invisible (e.g. placing it off the screen) and load extra models there: Multiple instances of Autodesk Forge Viewer