ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / BuildingSceneLayer Class / GetAvailableFieldsAndValues Method
Example

In This Topic
    GetAvailableFieldsAndValues Method
    In This Topic
    Gets all available fields and their corresponding values for a building scene layer. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetAvailableFieldsAndValues() As Dictionary(Of String,List(Of String))
    public Dictionary<string,List<string>> GetAvailableFieldsAndValues()

    Return Value

    Dictionary{System.String, List{System.String}}"/>
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Any combination of the available fields paired with one or more of their corresponding values can be added to the FilterBlockDefinition.SelectedValues for a given filter block
    Use GetAvailableFieldsAndValues to determine what the available fields and values are that can be used for a given BuildingSceneLayer
    Example
    Query Building Scene Layer for available Types and Values
    {
      // Note: call within QueuedTask.Run()
      {
        var dict = bsl.GetAvailableFieldsAndValues();
    
        //get a list of existing disciplines
        var disciplines = dict.SingleOrDefault(
                 kvp => kvp.Key == "Discipline").Value ?? new List<string>();
    
        //get a list of existing categories
        var categories = dict.SingleOrDefault(
                 kvp => kvp.Key == "Category").Value ?? new List<string>();
    
        //get a list of existing floors or "levels"
        var floors = dict.SingleOrDefault(
                 kvp => kvp.Key == "BldgLevel").Value ?? new List<string>();
      }
    }
    Create a Filter using Building Level and Category
    {
      // Note: call within QueuedTask.Run()
      {
        //refer to "Query Building Scene Layer for available Types and Values
        var dict = bsl.GetAvailableFieldsAndValues();
        var categories = dict.SingleOrDefault(kvp => kvp.Key == "Category").Value;
        //get a list of existing floors or "levels"
        var floors = dict.SingleOrDefault(kvp => kvp.Key == "BldgLevel").Value;
    
        //Make a new filter definition
        var fd = new FilterDefinition()
        {
          Name = "Floor and Category Filter",
          Description = "Example filter",
        };
        //Set up the values for the filter
        var filtervals = new Dictionary<string, List<string>>();
        filtervals.Add("BldgLevel", new List<string>() { floors[0] });
        var category_vals = categories.Where(v => v == "Walls" || v == "Stairs").ToList() ?? new List<string>();
        if (category_vals.Count() > 0)
        {
          filtervals.Add("Category", category_vals);
        }
        //Create a solid block (other option is "Wireframe")
        var fdef = new FilterBlockDefinition()
        {
          FilterBlockMode = Object3DRenderingMode.None,
          Title = "Solid Filter",
          SelectedValues = filtervals//Floor and Category
        };
        //Apply the block
        fd.FilterBlockDefinitions = new List<FilterBlockDefinition>() { fdef };
        //Add the filter definition to the layer
        bsl.UpdateFilter(fd);
        //Set it active. The ID is auto-generated
        bsl.SetActiveFilter(fd.ID);
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also