This post is a shorthand version of a workshop that I was teaching recently at AEC Symposium and Hackathon that our kind folks at TT organized. I think it originally came to be when Jason Howden has asked me for some small improvements to Mandrill, and sent me an example of how his firm evaluates Revit warnings. That’s when I realized that there wasn’t really a good way of doing warning parsing, and that it should be looked at. That’s not exactly when I realized that Revit warnings are a steaming pile of garbage – I am pretty sure I knew about it before. There is virtually zero API exposure in that area, and even though the Revit team claims that its coming soon, it’s about 10 years too late. Anyways, here’s my take on it:
Now, to produce that complete “report”, it would be a really long explanation, so I will let you guys fill in the blanks and instead just cover the initial data processing of the HTML Warning file that Revit outputs, introduce all of the new nodes for Dynamo and show you what they do. Let’s start at the beginning and that is what are the warnings and how to get hold of them.
While working in Revit, we will occasionally manage to produce a warning. Those things are only slightly annoying, as they are usually pop up windows with some ambiguous message, and an OK button that allows us to dismiss them and just keep going. Even though it looks like they are gone, they are not. Revit stores them in the file, and that can have some consequences in the long run. Why? Because now, when you open your file these warnings need to be re-instantiated, and that can not only slow it down, but also potentially cause issues. I personally, prefer to keep the warnings at a minimum, and do some checkups throughout the life of a project. Some warnings are easily fixable, and some are a little more involved. That’s why I also like to rate my warnings on a scale of 1-3, with 1 being ignorable and 3 severe. Now, the issue with Revit API is that it doesn’t provide any access to these warnings programmatically. One has to use the user interface, and export them to an HTML file, but even that is not very well thought out, as some of the naming conventions in Revit clash with HTML encoding, causing some weird looking tables. Anyways, we won’t get into that. Let’s have a look at how we can access these warnings, once we have them exported to HTML.
First we need to parse the HTML file like so:
What this does it creates a sort of internal warning library that we can now operate on. We can do things like see what elements generated these warnings:
This returns a list of elements for each warning. It might be just a single item, or multiple items for warnings where two or more elements participated in its generation. One example is a Wall and Room Separation line overlapping. That will return two elements. These elements are not typical Dynamo elements as in they are generated from a HTML file, hence have no connection to your Revit file. Keep in mind that since you exported the HTML file, element Ids might change so trying to obtain actual Revit elements from Warning parsing might not always work out. However, if that was the goal you can do so like this:
I am not showing you results here on purpose. This HTML file was generated at work, and I don’t have the file with me at home. My results are all null, but you get the idea. Also, all of these nodes are part of the Archi-lab package.
Also, each warning element, depending on what generated it, might have different information about it stored. We can query it up like so:
As you can see some warnings have Design Option information, but some don’t. That’s because if a warning was generated by somehow misusing the design option functionality, it will have that Design Option info listed. Others were not, and for those we might only have things like Workset, Category or Type. Also keep in mind that for things like annotation, the Workset value returned is usually a View that such annotation resides in since they are view based and do not actually exist in Worksets.
Now, let’s talk about Warning rating. It’s a custom property that I added to Warnings to help me categorize them and create the nice chart that i posted above. The idea is that warning is rated from 1-3 based on a custom reference table. For this case I have used a CSV file that has two columns, warning message, and rating that I wish to assign to it. Why an external CSV file? Well, I realize that for me as an architect, I want to pay more attention to warnings related to Rooms, Walls etc. For a structural engineer or MEP guy, other types of warnings might have a greater meaning, so he can have his own CSV rating reference table. Here’s how to use that:
Here’s what the library needs to look like:
It’s important to make sure that the CSV file has headers and these two columns in it.
Once we assign the rating, we can sort and organize our warnings in all sorts of ways. Each warning also has a handful of properties like this:
We already discussed the Elements and Rating properties of a Warning. Let’s talk about the Message and Assigned Message. Message is the first column of our HTML report. It should give us some details about the cause of the warning as well a possible solution. These are usually good enough to identify different types of warning, since they will have the same message. However, there are cases when the same or similar warning will have a different message. One case is how Design Option related warnings get reported. They always include Design Option name, and since the same type of a warning can be generated by different elements in different design options its possible to have all of these warnings with different messages that basically say the same thing. In order to be able to group them together and get proper counts, I introduced the “Assigned Error Message” property. This property allows us to add a custom message to our warning so that we can do things like this:
What’s happening in this image is that we are taking all of the warnings, and searching for ones that have word “design” in their Message property. Then we assign a custom error message to all of the warnings, that says “Design Option Related Warning”. Once we do that, we re-join the lists back to their original order, but now, every Design Option related warning has the same message. That way we can just group them together as one type. The Python component here does this:
It takes the list of True/False boolean mask and searches out index values for all True items. That way we can use those to replace all elements in the original list.
I think that’s all I have for this new functionality. All of these nodes are available in the Archi-lab package, so please download them from the Package Manager. If you just want to give the whole thing a try using my sample warning files, and warning library, just give this a whirl:Warning Parsing Sample (1276 downloads)
This file is dependant on UI++, Archi-lab and Mandrill packages.
Please let me know if something is not clear, and I will try and help out. Cheers!
So it looks like people want all of the Revit warnings in a list. Here’s how:
Remember that like I have said in the comments, these are in some cases templates, so they won’t contain a warning message exactly like one you might encounter in your HTML report.