ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / BuildingSceneLayer Class / UpdateFilter Method
The filter definition to update

In This Topic
    UpdateFilter Method
    In This Topic
    Update a filter. This method must be called on the MCT. Use QueuedTask.Run.
    public void UpdateFilter( 
       FilterDefinition filterDefinition
    Public Sub UpdateFilter( _
       ByVal filterDefinition As FilterDefinition _


    The filter definition to update
    filterDefinition is null
    the filterDefinition is invalid
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Modify BuildingSceneLayer Filter Name and Description
    //Must be called on the MCT
    //var bsl = ...;
    //var filter1 = bsl.GetFilter(filterID1);
    filter1.Name = "Updated Filter Name";
    filter1.Description = "Updated Filter description";
    //At 2.x - bsl.SetFilter(filter1);
    Create a Filter using Building Level and Category
    //Must be called on the MCT
    //refer to "Query Building Scene Layer for available Types and Values"
    //var bsl = ...;
    //At 2.x
    //var dict = bsl.QueryAvailableFieldsAndValues();
    //var dict = bsl.GetAvailableFieldsAndValues();
    //var categories = dict.SingleOrDefault(kvp => kvp.Key == "Category").Value;
    //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
    //At 2.x - bsl.SetFilter(fd);
    //Set it active. The ID is auto-generated
    Modify BuildingSceneLayer Filter Block
    //Must be called on the MCT
    //Assuming retrieve filter ok
    //var bsl = ...;
    //var filter1 = bsl.GetFilter(...);
    var filterBlock = new FilterBlockDefinition();
    filterBlock.FilterBlockMode = Object3DRenderingMode.Wireframe;
    var selectedValues = new Dictionary<string, List<string>>();
    //We assume QueryAvailableFieldsAndValues() contains "Walls" and "Doors"
    //For 'Category'
    selectedValues["Category"] = new List<string>() { "Walls", "Doors" };
    filterBlock.SelectedValues = selectedValues;
    filter1.FilterBlockDefinitions = new List<FilterBlockDefinition>() { filterBlock };
    //At 2.x - bsl.SetFilter(filter1);

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also