简体   繁体   中英

How to get the properties group names in autodesk forge

I would like to know is there any way to get the property group names in autodesk forge. I have tried with getProperties() and getBulkProperties() but I cant get the group names. How to achieve this. Thanks in advance.

我只需要突出显示组名

Property group is not named as group in the Forge viewer. It's called category in this case, and can be accessed via the displayCategory . Here is an example:

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 );
        }
    }
});

BTW, you can see more detail from this blog: https://forge.autodesk.com/cloud_and_mobile/2015/05/adding-custom-meta-properties-to-the-viewer-property-panel.html

Hope this help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM