简体   繁体   English

如何在Autodesk Forge中获取属性组名称

[英]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. 我想知道有什么方法可以在Autodesk Forge中获得属性组名称。 I have tried with getProperties() and getBulkProperties() but I cant get the group names. 我曾尝试使用getProperties()getBulkProperties()但无法获取组名。 How to achieve this. 如何实现这一目标。 Thanks in advance. 提前致谢。

我只需要突出显示组名

Property group is not named as group in the Forge viewer. 在Forge查看器中,属性组未命名为group It's called category in this case, and can be accessed via the displayCategory . 在这种情况下,它称为category ,可以通过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 顺便说一句,您可以从此博客中查看更多详细信息: https : //forge.autodesk.com/cloud_and_mobile/2015/05/adding-custom-meta-properties-to-the-viewer-property-panel.html

Hope this help. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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