代码之家  ›  专栏  ›  技术社区  ›  user8265273

如何在autodesk forge中获取特性组名称

  •  1
  • user8265273  · 技术社区  · 7 年前

    getProperties() getBulkProperties() 但是我不能得到组名。如何实现这一点。提前谢谢。

    I need to get only the highlighted group names

    1 回复  |  直到 7 年前
        1
  •  1
  •   Eason Kang    7 年前

    属性组未命名为 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

    希望这有帮助。