digging through revit warnings to find meaning

image by archi-lab

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:

Untitled-1

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:

Untitled-2

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:

Untitled-3

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:

Untitled-4

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:

Untitled-5

Here’s what the library needs to look like:

Capture

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:

Untitled-6

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:

Untitled-7

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 (484 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!

 

Edit: 2017/01/16

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.

Good luck!

25 Comments

  1. Greg McDowell says:

    This is great Konrad. Thanks for sharing!

    2 questions; is there a list somewhere of all the possible warnings Revit generates from which you created your CSV file, and are you creating the graph at the top of the post in Dynamo or just using Excel?

    • There is a way to obtain such list, but you don’t want it. Why? Because that list is just a template. Each warning is generated individually by passing it through that template. What that means is warnings list stored internally by Revit has blanks in it that are filled by actual elements when they are posting a warning. It makes it not very usable for this purpose. Also, its 900+ warnings long, and you will not see even 10th of that on a average project. If you still want to see it, i will save that thing out to Excel and send it to you. Even better, just make a new post on Dynamo Forum and i will reply there with Python code to get that.
      The graph/report that is posted on top of the post is created using these new warning parsing nodes from Archi-lab and Mandrill package. Just download the sample file and you should be able to get the same thing. Of course you will need a different warning rating library as you are likely to get more/different warnings.

      Cheers!

      • Troy Gates says:

        I’d be interested in an example of getting a list of all the possible warnings in Revit. Looking forward to your post on how to get them.

        Thanks

        • Troy,

          Please see the post above. I have made posted the code you are asking for.

          Cheers!

          • Greg McDowell says:

            I see what you’re getting at now. So, do you think the workflow would be to export the warnings, go through them in Excel to generate the ratings, and then use these as a CSV to run in Dynamo? I had hoped to be able to generate a single CSV file to apply to all projects in advance. It now looks like that the CSV file will/may grow over time. Good to know.

            Thanks again.

          • Troy Gates says:

            I used your Python code to write a macro in C#. It worked out great.

            Here is the text file I got when running the macro in Revit 2017: https://app.box.com/s/1a1zig324s9zxp9o6izqru1dum1gtm26

  2. Helen Gorina says:

    Thanks for sharing!
    I have also made an attempt to triage through various warnings and shared it at RTC2014.
    At that time, there was no API to warnings, and instead of using dynamo, I have used Excel Pivot tables to triage the warnings from the HTM report.
    If it helps anyone to understand what warnings’ criptic language means, attached is a PDF, and you can find dataset here:http://rtcevents.com/rtc2014au/materials/

  3. Stavros Koulis says:

    Thanks for sharing this Konrad,

    Great work with the Mandrill / D3.js stuff.

    Quick question on the “create names that will be displayed when hover over a donut chart slice.” group. Are the ratings listed in different order between the first and second code blocks?

    Cheers,

    Stavros

    Attachment:  warnings.png

  4. Jean-Marc Couffin says:

    Hi Konrad,
    Very nice job.
    Next step to become the perfect Model manager would be to check warnings from a list of models (filepaths) _without actually opening the whole file… You would then get a fairly honest routine to check the health of models company wide.
    I have been looking at nodes to get informations from a model without opening it, and all I could find was in the Bakery nodes: “Get Build Number from All RVTs in a Folder” for example. Do you think this can be achieved?

    • Well you will be able to fully automate this routine as soon as Revit 2018 comes out. Currently there is no way to extract warnings out of the file other than manually exporting them to an HTML report. I intend to update this method as soon as 2018 API is out.

  5. kirsty hogg says:

    Is there an easy way to find the most comment MEP revit warnings to create a csv file from?

  6. kirsty hogg says:

    Also i ran this dynamo script using your csv file but one of my own HTML warning files and i received the below errors on nodes. I’m relatively new to dynamo and could use some guidance as to what is going wrong?

  7. Thank you for sharing, this is awesome.

    I didn’t manage to structure my Warning Library.
    I believe it is related to one of these reasons :
    – the accents in french
    or
    – the format

    If you could help me out I would appreciate it.

  8. Antonio says:

    Thanks Konrad, amazing way of quickly sorting the warnings of our projects.

    I have tested it on Revit 2016 with Dynamo 1.2.1 and it works perfectly. But I am trying to use it with Revit 2017.2 and my dynamo is crashing.
    It is not a big issue because I can always use 2016, but is kind of an extra step opening both versions.
    Do you know what might be the issue?

    Thanks!

    Attachment:  Dynamo_Crash.png

  9. Ahmed Salah says:

    it runs ok without errors but I have the final node “Report Window ” as empty!
    check attached!

    Attachment:  Warning-Error.jpg

  10. Luis Greco says:

    Hi Konrad, this is great! thanks for sharing.

    I am new to Dynamo and I having trouble with the warning parsing. All my chart style nodes show a warning: “the input types are not matching”. Do you know what I am doing wrong? Could it be my list of colors?

    Thanks!

    Luis

    Attachment:  Capture-Graphs.png

  11. Luis Greco says:

    Never mind. It work! Thanks!

    Attachment:  Report.png

Leave a Comment