【问题标题】:Change properties panel of the model in Forge Viewer在 Forge Viewer 中更改模型的属性面板
【发布时间】:2021-02-12 20:08:31
【问题描述】:

如何过滤模型的属性列表并从属性面板中隐藏一些属性?

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:

    您应该阅读 Augusto 的 this article。本文向您展示了如何添加属性,但从列表中删除/过滤属性的原理相同。以下是您可能需要的一些 API:

    /**
    * Adds the given properties to the display panel.
    * @param {Array} properties - An array of properties, each property represented as {displayName: name, displayValue: value}.
    * @param {Object=} [options] - An optional dictionary of options.  Currently unused.
    */
    PropertyPanel.prototype.setProperties = function (properties, options) 
    
    /**
    * Adds a property to this panel.  The property is defined by its name, value, and category.  The
    * add will fail if a property with the same name, value, and category already exists.
    *
    * @param {string} name - The name of the property to add.
    * @param {string} value - The value of the property to add.
    * @param {string} category - The category of the property to add.
    * @param {Object=} [options] - An optional dictionary of options.
    * @param {boolean} [options.localizeCategory=false] - When true, localization is attempted for the given category
    * @param {boolean} [options.localizeProperty=false] - When true, localization is attempted for the given property
    * @returns {boolean} - true if the property was added, false otherwise.
    */
    PropertyPanel.prototype.addProperty = function (name, value, category, options)
    
    /**
    * Returns whether this property panel currently has properties.
    *
    * @returns {boolean} - true if there are properties to display, false otherwise.
    */
    PropertyPanel.prototype.hasProperties = function ()
    
    /**
    * Removes a property from this panel.  The property is defined by its name, value, and category.
    *
    * @param {string} name - The name of the property to remove.
    * @param {string} value - The value of the property to remove.
    * @param {string} category - The category of the property to remove.
    * @param {Object=} [options] - An optional dictionary of options.  Currently unused.
    * @returns {boolean} - true if the property was removed, false otherwise.
    */
    PropertyPanel.prototype.removeProperty = function (name, value, category, options) 
    

    【讨论】:

    • 我可以使用 removeProperty 删除类别吗?
    • @DanilaEremenko,要删除一个类别,您需要从该类别中删除所有属性
    猜你喜欢
    • 2019-11-01
    • 2020-12-14
    • 1970-01-01
    • 2018-09-04
    • 2019-06-02
    • 2021-10-02
    • 2022-07-06
    • 2019-01-04
    • 2019-08-27
    相关资源
    最近更新 更多