属性组未命名为
group
在Forge viewer中。它叫
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
希望这有帮助。