Skip to content

Filtering Elements in Revit Using Dynamo and the List.FilterByBoolMask Node


Filtering is necessary when using Dynamo to select elements. For example, if we were looking for all exterior doors in a project, we would use Dynamo to grab all the doors in a project and then filter down the ones that have the type Function parameter set to Exterior. Similarly, you may want to filter out elements that meet a condition.

In the following example, you will report all the reference planes in a Revit project which have not been named.

  1. Create a script that will collect all reference planes in a project. You accomplish this by extracting all reference plane elements from the project.
  2. You then check to see which elements have no name by evaluating which ones are equal to an empty string node. This generates a list of elements that is equal in length to the number of true and false values.
  3. You utilize the List.FilterByBoolMask node to feed it both the list of elements and “mask” of true/false values. Essentially, if the list element matches a true, it will be allowed through, otherwise it will be filtered out of the list. The result is a filtered or reduced list of the reference planes which are not named.

This method is a basic skill that allows you to easily create scripts that can work in different project files. The reference plane example is useful because there is no direct way of scheduling all the reference planes in a project using the Revit interface. Similarly, if you had to edit rooms or spaces and select them automatically, you may need to filter the master list of all elements to the subset that you are interested in using a similar method to the one illustrated.

Please note that the sample file used in the screencast is available for download on the Autodesk Knowledge Network.

Posted in

Related Posts