Seriously Simple Object Style Audits
In this article we will look at ways that Dynamo can help with the process of auditing a Revit file. These methods are available via my Rhythm package.
To get started we need to launch Dynamo on top of the Revit file we are working with. This can be done from the Manage tab in Revit 2017+, or on the Add-ins tab in prior versions.
Figure 1: Dynamo for Revit 2018
Once we are in Dynamo we have access to node libraries and third-party workflows called packages. For the workflows we are covering in this article, we need to install the package called Rhythm. To learn more about how to install a package view this video:
Making Category Selections
Once we have Rhythm installed we can start working with data in our Revit model. In our case, we are going to obtain a lot of data regarding object styles of categories. This means we need to start with a few OOTB (out of the box) category nodes. The category selection node is under the following hierarchy, Revit>Selection>Category
Figure 2: Category selection node
When we have a few category nodes placed and category selections made, we can tell Dynamo that we need to combine those selections to parse them for data. (Note that you can add as many category nodes as you want.)
Figure 3: Combined list of user-selected categories for analysis
Retrieving Data from the Categories
Unfortunately, there are no OOTB methods for extracting data from the categories we selected. This is where the custom package Rhythm comes into play. Luckily, when Dynamo is missing a functionality, people from the community [https://forum.dynamobim.com/] can add the functionality for everyone to use.
To find the nodes in Rhythm that parse the categories in Revit, we will navigate to the following hierarchy, Rhythm>Revit>Elements>Category.
Figure 4: The category nodes in the Rhythm library
Once we find the appropriate nodes for category, we will place the ones related to the data we want. For this example, we will obtain the Line Color, Line Pattern and Projection Line weight from the categories. We can place the nodes and combine them back into one list.
Figure 5: Data extraction + combination
Getting Ready to Write to Excel
Well, this data needs to end up somewhere, so why not use something most people are familiar with, like Excel? Luckily, Dynamo offers OOTB options for Excel read and write. We will use the node “Excel.WriteToFile.” You must have Excel installed to use this node.
Figure 6: Excel.WriteToFile node
As you can see in Figure 6, we have several inputs to fulfill. First is the file path. We can use a string node and define what we want the file to be named. In my case I will just use my desktop.
Figure 7: Excel file to be created
For the next few inputs, we can supply some typical values. The sheet name can be whatever you want and start row and column are typically “0,” so we begin at the top and left of the sheet.
Figure 8: Fulfilled inputs for Excel setup
The next step is to organize the data for Excel to display how we want. Currently the combined data will write to Excel horizontally and we want it organized in a better manner. That means we need to add the category name to this list, so we know what we are looking at. In Figure 9, you will see the state of our graph at this point with the category name incorporated.
Figure 9: New combined data
Next, we need to organize the data in the appropriate columns for Excel. This is achieved using a process called “transposing.” In Dynamo there is a node to do this for us.
Figure 10: Transposing data
The last thing we need to do is plug our data into the “data” input for Dynamo to write to Excel for us! Once you do this Dynamo will think for a moment and Excel will open.
Figure 11: Our finished graph
How Does It Look in Excel?
Once Dynamo writes the data to Excel it will open automatically for us. We can then see our results and marvel at their glory.
Figure 12: Excel data
We only wrote data for three categories, so it isn’t the most impressive amount of data ever. But, we can now use this logic to build out full-blown data harvesting.
Also, how do I know what data I am looking at in Excel? Well, we can most certainly add headers to this process as well. This is achieved as shown in Figure 13.
Figure 13: Revised graph with headers
And you can see how our new data looks inside Excel as well (Figure 14).
Figure 14: Revised graph with headers
Well, there you have it—a simple way to extract data from Revit categories and write it to Excel using Dynamo. You can most certainly build upon this dataset and do some awesome stuff!
John Pierson is a Design Technology Specialist at Parallax Team and a Revit certified professional for all disciplines. At Parallax, he is engaged in the creation of automated workflows and the exploration of computational design solutions for the AEC industry. John is a frequent presenter at user groups and conferences. He is also an active member of the Dynamo community and currently manages the Dynamo package called Rhythm, which is among the top five most downloaded. You can find John on Twitter, @60secondrevit, his blog at sixtysecondrevit.com, or on Parallax at parallaxteam.com