使用Forge-Viewer库查询属性而无需渲染模型

发布于 2025-02-13 12:44:20 字数 454 浏览 0 评论 0原文

我正在使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉城 2025-02-20 12:44:20

如文档所述, 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:

enter image description here

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文