使用 autodesk360 获取 3d 模型中突出显示组件的 guid ID

问题描述

这是我在 stackoverflow 上的第一篇文章。 我正在使用 autodesk360,上传 rvt 文件并获得 iframe 并在我的网页中显示 3d 模型。 我想知道当我在 3d 模型上单击 iframe 中的任何组件时,我想获取该组件的 guid id。我怎么能得到那个? 这是我在我的网页中使用的 iframe。 Screen shot is here

解决方法

在您自己的网页上嵌入“Autodesk 360 之类的东西”的正确方法是使用 Autodesk Forge 平台,更具体地说,是使用 Forge Viewer JavaScript 库。通过这种方式,您还可以避免使用 <iframe> 的需要,因为 viewer.addEventListener(Autodesk.Viewing.SELECTION_CHANGED_EVENT,function () { const selectedIds = viewer.getSelection(); if (selectedIds.length === 1) { viewer.getProperties( selectedIds[0],function onSuccess(props) { console.log(props.externalId); // see if the "external ID" extracted by Forge contains the GUID you're looking for console.log(props.props); // or if the GUID is included somewhere in the properties },function onError(err) { console.error(err); } ); } }); 使用起来很棘手。

(顺便说一句。Autodesk 360 是一个产品,也是使用 Forge 平台构建的。)

如果您对 Forge 开发的一些入门指南感兴趣,请查看 https://learnforge.autodesk.io。有一个名为 View BIM360 & Fusion models 的教程,可引导您开发可在 BIM360、Fusion Team 或 Autodesk 360 中访问和查看您的设计的网络应用程序。

在您的 Forge 应用程序启动并运行后,获取当前所选组件的属性非常简单。您可以在“选择更改”时简单地处理事件,并使用查看器 API 检索所选对象的属性:

conda install -c anaconda opencv