EDIT: Updated to include a custom Python node to get all elements in active view as the OOTB node was returning unexpected results.
EDIT 2: Updated again to include a more robust method of getting valid categories for the filters as well as a regex pattern to ensure valid filter names.
EDIT 3: Now excludes existing filters, allowing it to be run on a view with new values without overriding existing filters.
I’ve put together this graph to generate view filters automatically based on unique parameter values of a given parameter. Currently, there are two primary inputs:
- Parameter Name
- Rule Type
It seems to be working pretty well, although it’s not perfect.
- Parameters are found by name, which does not guarantee that the exact parameter will be found–it is best to use this with a custom parameter which does not share its name with any other parameters.
- Colors are not guaranteed to be unique (although highly unlikely). More importantly, adjacent elements with different, but similarly colored, filters may be hard to distinguish from one another, but there is no easy way to prevent this.
- This is made in Revit 2019 using Dynamo 2.0.3. I have not yet used Revit 2020 nor its packaged version of Dynamo, but this graph may not work in later versions, mainly due to the OverridGraphicSettings.ByProperties node. The corresponding OverrideGraphicSettings class has been updated in the API as all of the “Fill” methods have been replaced with similar “Foreground” and “Background” methods
The filter names are currently being generated by using the parameter name and its respective value, joined with an underscore, although this can be modified.
View Filters - Create Unique.dyn (147.7 KB)