【发布时间】:2017-08-21 13:27:47
【问题描述】:
我想知道有没有办法在 Autodesk forge 中获取属性组名称。我尝试过使用getProperties() 和getBulkProperties(),但我无法获得组名。如何实现这一点。提前致谢。
【问题讨论】:
我想知道有没有办法在 Autodesk forge 中获取属性组名称。我尝试过使用getProperties() 和getBulkProperties(),但我无法获得组名。如何实现这一点。提前致谢。
【问题讨论】:
属性组在 Forge 查看器中未命名为 group。在这种情况下,它称为category,可以通过displayCategory 访问。这是一个例子:
var selection = viewer.getSelection();
viewer.getProperties( selection[0], function( result ) {
const props = result.properties;
for( let i = 0; i < props .length; i++ ) {
const property = props[i];
if( property.hidden) return;
const category = props[i].displayCategory;
if( category && typeof category === 'string' && category !== '' ) {
// The property group you want
console.log( category );
}
}
});
顺便说一句,你可以从这个博客看到更多细节:https://forge.autodesk.com/cloud_and_mobile/2015/05/adding-custom-meta-properties-to-the-viewer-property-panel.html
希望对您有所帮助。
【讨论】: