使用 autodesk360 获取 3d 模型中突出显示组件的 guid ID
Get guid ID of highlighted component in 3d model using autodesk360
这是我在 Whosebug 上的第一个 post。
我正在使用 autodesk360,上传 rvt 文件并获得 iframe 并在我的网页中显示 3d 模型。
我想知道当我在 3d 模型上的 iframe 中单击任何组件时,我想获取该组件的 guid id。我怎样才能得到它?
这是我在网页中使用的 iframe。
Screen shot is here
在您自己的网页上嵌入“类似 Autodesk 360 的东西”的正确方法是使用 Autodesk Forge 平台,更具体地说,是 Forge Viewer JavaScript 库。通过这种方式,您还可以避免使用 <iframe>
,这可能很难处理。
(顺便说一句。Autodesk 360 也是使用 Forge 平台构建的 产品。)
查看 https://learnforge.autodesk.io if you're interested in some starting pointers in Forge development. There's a tutorial called View BIM360 & Fusion models 了解如何开发 Web 应用程序,该应用程序可以在 BIM360、Fusion Team 或 Autodesk 360 中访问和查看您的设计。
启动 Forge 应用程序并 运行,获取当前所选组件的属性非常简单。您可以在“选择更改”时简单地处理一个事件,并使用查看器 API 检索所选对象的属性:
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);
}
);
}
});
这是我在 Whosebug 上的第一个 post。 我正在使用 autodesk360,上传 rvt 文件并获得 iframe 并在我的网页中显示 3d 模型。 我想知道当我在 3d 模型上的 iframe 中单击任何组件时,我想获取该组件的 guid id。我怎样才能得到它? 这是我在网页中使用的 iframe。 Screen shot is here
在您自己的网页上嵌入“类似 Autodesk 360 的东西”的正确方法是使用 Autodesk Forge 平台,更具体地说,是 Forge Viewer JavaScript 库。通过这种方式,您还可以避免使用 <iframe>
,这可能很难处理。
(顺便说一句。Autodesk 360 也是使用 Forge 平台构建的 产品。)
查看 https://learnforge.autodesk.io if you're interested in some starting pointers in Forge development. There's a tutorial called View BIM360 & Fusion models 了解如何开发 Web 应用程序,该应用程序可以在 BIM360、Fusion Team 或 Autodesk 360 中访问和查看您的设计。
启动 Forge 应用程序并 运行,获取当前所选组件的属性非常简单。您可以在“选择更改”时简单地处理一个事件,并使用查看器 API 检索所选对象的属性:
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);
}
);
}
});