Dynamo for MEP
Most examples of Dynamo focus on computational design and complex geometries. Many see Dynamo as a tool for creating complex geometry, and consider it from an architectural perspective. But Dynamo can be the powerful ally of every trade, all along the project life. By harnessing the data manipulation capabilities of Dynamo, you can largely improve on the current calculation features of Autodesk® Revit® and create new workflow for designing directly in Revit.
Through five use cases, I will present you some ideas for using Dynamo for mechanical engineering.
I will assume that you are already familiar with the interface and have a general understanding of how Dynamo works. Most examples below can be realized with “out of the box” Dynamo nodes, but to shorten my graph, I will make use of the following packages:
- Grimshaw, from Konrad K. Sobon
- Steam Nodes, from Julien Benoit
I will also use my own package, DynamoMEP, to manipulate Rooms and Spaces. All these packages are freely available on the Dynamo Package Manager.
If Dynamo doesn’t include a lot of functionalities around Room, Space, and Mechanical Equipment, I use extensively the Package Manager to enhance these functionalities and create new workflows for mechanical engineers.
A final word: try these examples on small models before running them in production, and work in "Manual" mode—a few graphs I will use are quite hungry for memory.
Link between Room and Spaces
Rooms and Spaces are essential for everything from room names and numbers to energy modeling. And before anything else, you have to retrieve any architectural room and convert it into an MEP Space to be able to work with it. You can, of course, use the "Place Spaces automatically" function of Revit, but this does not match exactly every architectural room with a MEP Space, and lacks some basic functionalities. To improve on this, you can use a few Dynamo nodes to create a MEP Space for every room in a given linked file.
The procedure focuses on retrieving every room from the architectural linked file (with the Element.GetFromLinkedFile) and using these rooms to create a matching space using the Space.ByPoint node from DynamoMEP.
You can also retrieve parameter values from these architectural rooms and paste them into your newly created Spaces using the Element.SetParameterByName node.
As rooms evolve in the architectural model, you will be able to recreate on the fly the corresponding Spaces. However, be careful not to duplicate an existing space.
Link between Excel and Spaces
One of the most featured uses of Dynamo is the link with Excel spreadsheets. Theses nodes link two of our most-used design tools, Excel and Revit.
For the mechanical engineer, this provides the ability to add programmatic values directly in Revit Spaces. In the following example, I will show you how to load the specified airflow value from an Excel spreadsheet. I will make extensive use of Dynamo lists and present some ways to manipulate them.
We start with a path to an Excel file and use it to feed the Excel.ReadFromFile node. This node read line by line the content of our Excel file. We remove the first line, the header, with the List.RestOfItems node, and use the Transpose node to convert our list of Excel rows into a list of Excel columns. By now, each list in our Dynamo node represents an Excel column.
With the List.GetItemAtIndex, we retrieve a list containing all MEP Space numbers and a list with their associate airflows.
To feed the “Specified Supply Airflow” parameter of our modeled Spaces, we need to match them with the Space number in our Excel spreadsheet. To do so, we start by retrieving them (All Element of Category node), and get their number (Element.GetParameterValueByName).
The node List.FirstItemOf gives us the row number of each of these Space Numbers in our Excel file. For each of the existing MEP Space in our model, we can now get the corresponding row in Excel.
Using the List.GetItemAtIndex, we get the required Airflow values in the Excel spreadsheet. Before pasting them into Revit with the Element.SetParameterByName, we convert them to cubic feet because Dynamo always works in feet.
The entire business of retrieving values from Excel spreadsheets is generally only a matter of list, and nodes such as Transpose, GetItemAtInded and FirstIndexOf are quite useful here. If this example only covers the specified airflow, it can of course be extended to every kind of data sorted in an Excel spreadsheet. Just make sure that your MEP Space numbers match between your Excel file and your Revit model, because any discrepancy will make the FirstIndexOf fail.
Link between Terminals and the Main Duct
To fully exploit duct sizing capabilities in Revit, we generally need a fully connected network between the mechanical equipment and air terminals. But drawing every duct for the entire network from source to terminal can be time consuming and not relevant in the early phase of a project, when architectural layout is subject to major changes.
Use Dynamo to link all terminals of a given area to a specific family in the shaft to be able to perform sizing calculations without having to draw every single duct.
A possibility is to use Dynamo to virtually link every terminal to a placeholder family that will collect and sum airflows in a given area and send the sum to a placeholder family used to perform duct sizing calculations on the main branch.
Revit provides us the Connect the main duct to "M_Rectangular Duct Connector - Supply Air - Air Terminal." This is a generic terminal that will simulate the rest of the terminals. We connect this generic terminal to our main branch, and use it to simulate the rest of the duct networks.
The following Dynamo definition sums airflows of the selected air terminal and passes the value in the airflow parameter of the placeholder family. This placeholder family now simulates the airflow of all selected air terminals. Since this family is connected to the main duct networks, we can now perform duct sizing for the main branch without having to model the entire duct layout.
A word of warning anyway—since this placeholder family is integrated into the system, flow sum for the duct system is multiplied by two, because Revit counts both the airflow of every air terminal and the airflow coming from the placeholder family.
From Specified Airflow to Actual Terminal Flow
Another example of the power of Dynamo comes when linking air terminals to their enclosing MEP Space.
In this example, we will see how to retrieve the required airflow in a given MEP Space, and distribute this value on every air terminal enclosed in this space.
We start by finding all MEP Space, and retrieving their "Specified Supply Airflow." We also get all air terminals and use the Space.IsInSpace node to find if a given terminal is in the space. We make sure to set up the lacing of this node to "Cross Product" in order to test every air terminal with every MEP Space. This gives us multiple lists of true or false indicating whether a given air terminal is in the space. With the usual combination of List.AllIndiceOf and GetItemAtIndex, we find our air terminals grouped by their enclosing space. We count the number of these terminals in each group, and use this count and a division to get the specified airflow on each terminal. The List.OfRepetedItem gives us an instance of this specified airflow by terminal. We finally apply these values to these terminals with the Element.SetParameterByValue.
As we update the Specified Airflow of each MEP Space, this value will be divided by the number of terminals in the space and applied to the said terminals.
Terminal Max Flow
Another application of Dynamo is the real-time checking for max values in a given terminal equipment. In this example, we will check whether the airflow of a given terminal is below a max value, and highlight in red when the airflow is above the max value.
In some way, this is similar to the conditional formatting function in Excel, except we are doing it directly into Revit.
We start by finding all air terminal units in Revit with the "All Elements Of Category" node. Using the GetParameterValueByName, we get the airflow on each of these air terminals. Since the Maximum Airflow is a type parameter, we use the FamilyInstance.Type node to retrieve the family type, then use again the GetParameterValueByName to find the "Max Flow."
We can now compare these two values and use the List.FilterByBooleanMask to find all terminals where Airflow is above the Max Airflow.
The last step is to override the color of these terminals to highlight the results.
This fairly simple example showcases the possibilities of Dynamo combined with the proper Revit objects library.
Through these five examples, we see how to use Dynamo to enhance your calculation powers in Revit. It is clear by now that Revit is far more than a modeling tool. When combined with Dynamo, it opens a lot of possibilities for mechanical engineers.
I want to give my deepest thanks to Andrew Duncan (http://thoughts.arup.com/post/userposts/282) from Arup for its great Autodesk university courses, where I get most of my inspiration for these examples.
Simon Moreau received a Master's Degree in Civil Engineering from the École Spéciale des Travaux Public in Paris, France. In 2013 after working on large international projects and developing parametric models on complex framing, Simon joined the building engineering consultancy Ingérop in the coordination department. He works with intelligent models, and he is also responsible for the development of Building Information Modeling (BIM) protocols, standards, and workflows in Ingérop’s building section. Simon also writes about BIM on his blog, BIM 42, and he is a Revit software add-in hobbyist with three plug-ins on the Autodesk App Exchange.