Request

Response

    Autodesk.Viewing
    Version 8 preview
    This page documents a preview of the Viewer SDK v8. APIs and content can still change before the final release.

    PropertySet

    The PropertySet class allows for aggregation of properties with the same names and categories. To get an instance of this class use Model#getPropertySetAsync.

    new PropertySet(result)

    Parameters

    result*
    Object
    * Required

    Examples

    // Use the model's getPropertySetAsync to get the PropertySet instance for the selected dbIds
    for (const { model, selection } of viewer.getAggregateSelection()) {
       const propSet = await model.getPropertySetAsync(selection);
       // iterate, aggregate, etc
    }
    

    Methods

    forEach(callback)

    Iterates over all of the common properties. The callback is invoked on each key in the property map.

    Parameters

    callback*Called for each entry in the map
    * Required

    getAggregation(properties)

    Returns an object containing aggregated values. see PropertySet#forEach

    Parameters

    properties*
    Array.<Object>, String
    either the key in the object or an array of properties
    * Required

    Returns

    typedescription
    AggregatedResult
    • Object with all aggregated values

    Examples

    propertySet.forEach((key, properties) => {
      const aggregation = propertySet.getAggregation(key);
    });
    

    getValue2PropertiesMap(properties)

    Returns an object with a key representing the property’s displayValue and the value being all of the property names associated with it.

    see PropertySet#forEach see PropertyResult

    Parameters

    properties*
    Array.<Object>, String
    either the key in the object or an array of properties
    * Required

    Returns

    typedescription
    Object
    • The key representing a common displayValue and the value representing all of the PropertyResult sharing that displaValue

    Examples

    propertySet.forEach((name, properties) => {
      const commonValues = propertySet.getValue2PropertiesMap(key);
    });
    

    getValidIds(displayName, displayCategory)

    Searches all of the keys in the map object and returns all valid keys that either match the displayName or categoryName.

    Parameters

    displayName*
    String
    the display name
    displayCategory*
    String
    the category name
    * Required

    Returns

    typedescription
    Array.<String>
    • an array of valid map ids

    getDbIds()

    Get the dbIds that are associated with the propertySet

    Returns

    typedescription
    Array.<number>
    • an array of dbids associated with the PropertySet

    getVisibleKeys()

    Returns an array of keys that contain visible properties

    Returns

    typedescription
    Array.<string>
    • array of keys

    getKeysWithCategories()

    Returns an array of keys that have properties with displayCategories

    Returns

    typedescription
    Array.<string>
    • array of keys

    merge(propertySet)

    Merges the passed in PropertySet map with the current PropertySet’s map.

    Parameters

    propertySet*A PropertySet instance
    * Required

    Returns

    typedescription
    PropertySet
    • returns from the passed in propertySet merged