Revit Use-Cases
Last updated
Last updated
Have you ever wanted to look up something in Revit by a piece of data that it has?
Chances are if you have you've done something like the following example.
In the image below we are collecting all of the rooms in the Revit model, getting the index of the room we want (by room number), and finally grabbing the room at the index.
Collect all rooms in the model.
Room number to find.
Get the room number and find what index it is at.
Obtain the room at the index.
Download the example file by clicking on the link below.
A full list of example files can be found in the Appendix.
Now let's recreate this idea using dictionaries. First we need to collect all of the rooms in our Revit model.
We choose the Revit category we want to work with, (In this case, we are working with rooms).
We tell Dynamo to collect all of those elements
Next, we need to decide what keys we are going to use to look up this data by. (Information on keys can be found on the section, What is a dictionary?).
The data that we will use is the room number.
Now we will create the dictionary with the given keys and elements.
The node, Dictionary.ByKeysValues will create a dictionary given the appropriate inputs.
Keys
need to be a string, whilevalues
can be a variety of object types.
Lastly, we can retrieve a room from the dictionary with its room number now.
String
will be the key that we are using to look up an object from the dictionary.Dictionary.ValueAtKey will obtain the object from the dictionary now.
Using this same dictionary logic, we can create dictionaries with grouped objects as well. If we wanted to look up all rooms at a given level we can modify the above graph as follows.
Rather than using the room number as the key, we can now use a parameter value, (in this case we will use level).
Now, we can group the rooms by the level that they reside on.
With the elements grouped by the level, we can now use the shared keys (unique keys) as our key for our dictionary, and the lists of rooms as the elements.
Lastly, using the levels in the Revit model, we can look up which rooms reside on that level in the dictionary.
Dictionary.ValueAtKey
will take the level name and return the room objects at that level.
The opportunities for Dictionary use are really endless. The ability to relate your BIM data in Revit to the element itself poses a variety of use cases.