【问题标题】:How to get the properties group names in autodesk forge如何在 Autodesk forge 中获取属性组名称
【发布时间】:2017-08-21 13:27:47
【问题描述】:

我想知道有没有办法在 Autodesk forge 中获取属性组名称。我尝试过使用getProperties()getBulkProperties(),但我无法获得组名。如何实现这一点。提前致谢。

【问题讨论】:

    标签: javascript autodesk-forge


    【解决方案1】:

    属性组在 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

    希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2017-02-18
      • 2021-05-08
      • 2018-09-12
      • 1970-01-01
      • 2021-01-17
      • 2019-04-07
      • 2017-01-29
      • 2018-01-14
      • 2018-05-13
      相关资源
      最近更新 更多