如何在 Autodesk Forge 中获取属性组名称
How to get the properties group names in autodesk forge
我想知道有什么方法可以在 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
希望对您有所帮助。
我想知道有什么方法可以在 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
希望对您有所帮助。