Anyone who has spent much time in Revit is almost undoubtedly aware of the hierarchical structure of Revit model families. All model families are assigned to a Category, and each Family usually has both multiple Types and Instances (though not always).
This hierarchy can be used when selecting Revit elements in Dynamo. And while the Dynamo primer does include a nice diagram of this hierarchy, it does not thoroughly demonstrate how each level of the hierarchy can be used to select elements.
The above diagram shows how the hierarchy is applied to Columns, but it can be applied to any model family within Revit. So for the following examples, I will be demonstrating how to utilize the Revit hierarchy to select different combinations of trees.
Here is the hierarchy structure for this Maple tree:
- Category: Planting
- Family: Plants – All Graphic – Trees
- Type: Deciduous – Large – Maple
- Instance: individual tree (element ID 1527871)
Though in Dynamo, everything but the Category will look a bit different. The Family and Type have “Family:” and “Family Type:” at the beginning and Instances will have their element ID at the end:
- Family: Family: Plants – All Graphic – Trees
- Type: Family Type: Deciduous – Large – Maple
- Instance: Deciduous – Large – Maple 1527871
Starting out at the top of the hierarchy, there are only a few nodes that will find Categories and Families. Categories are usually selected using the dropdown Categories node while a Family can be found from either a Type or an Instance. Both can also be selected using a string.
The lower two levels of the hierarchy are generally more useful and thus have a few more nodes. Type (or Family Type, as it’s called in Dynamo) can be selected from any level if you have the right combination of nodes. There is also a Family Type dropdown node, but it can often be cumbersome to use.
Instances (or Elements) can also be selected from any level. You can also manually select instances using the Select Model Element(s) nodes.
And finally, since Category, Family, and Type can all be selected via string, here is how you can find those strings. Though for some reason, the Category string needs “OST_” at the beginning in order to work in reverse (see Find Category from string, above).
From what I could tell there was no way to select Instances using their IDs, though this is not surprising since the ID parameter is essentially just a random integer (or string) and would not be useful for selecting elements.