I was wondering if it was possible to get warnings from linked model? It’s a bit comprehensive and tedious to open several models in a project and run a script, so it would be nice to be able to collect the warnings from the linked models and output them in a single Excel file.
Unfortunately, the way Bang is written it will only work on the current document and I don’t plan on changing that in the package. The main reason is because the UI nodes simply use the active document since there is no input for a Document element. Another issue is that Bang was created to help provide framework to resolve warnings. When you have background opened documents, it is very difficult to make changes to them and that would become very difficult to manage.
If I were to entertain the idea of adding Document inputs to warning nodes there would be a pretty large disclaimer that it is only for queries. Let me think on that one some more.
That being said, the method I am using is Document.GetWarnings which was added to the Revit 2018.1 API. That method does take a document and I do not see why someone couldn’t build nodes (Python or C#) that could handle that.
@john_pierson Thanks for your reply. I only want to make queries. My purpose is not to resolve warnings automatically. I have a Power BI dashboard with information gathered from the main model and the linked models. I just want to show statistics of the warnings and make my team aware of the amount, what categories they are and the ratings.
I have no experience with Python or C#, so making my own node would be quite hard at this point. I was only asking if the possibility already existed.
I have no experience with Bang but how would you want the node to output the warnings? From here, you can see everything that can be extracted from a warning, including the description text and the element Id.
Going off the method @john_pierson gave and the linked doc collector from this thread Revit link elements, courtesy of @cgartland, this python code will give you a list of warnings with their respective elementid from all of the linked docs.
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
current_doc = DocumentManager.Instance.CurrentDBDocument
links = FilteredElementCollector(current_doc).OfClass(RevitLinkInstance)
docs = [link.GetLinkDocument() for link in links]
all_warnings = 
for doc in docs:
warns = doc.GetWarnings()
warnings = 
for warn in warns:
elems = 
for elem in warn.GetFailingElements():
OUT = all_warnings
Let me know what you would want added to the list.
Edit: updated to return the actual element instead of elementid
@kennyb6 That’s great, thank you - I knew there were some brilliant minds in here. I will try it out.
Can I filter the output? I have about 6 architectural links and the same amount of engineering models, which I don’t want to get the warnings from. So I would want to sort the warnings from the different models, so I can see which warnings come from which model.
In this I was testing different outputs so that version currently outputs the description of the warning, the possible resolution (if none then it will say none available), and the severity. The dictionary name is the linked model’s name (something.rvt).
I don’t know why the script freezes for you. I am using Dynamo 2.0.2 with Revit 2018 and it works fine for me. This version will give you dictionaries of each linked model with the description text, resolution, list of element ids, and severity, in that order.
I tried it on a different document and it worked just fine now. This is very very good - thank you.
I just need to add warnings from the current model as well and assign the warnings to their respective levels. Can I assign the warnings based on the dictionary values or do I need to do that in the Python script?
I’m just trying to filter the output, so that all warnings have the correct model assigned to them.
So when it’s transposed and exported to Excel, each line contains: model name, warning msg, warning solution, warning id’s.
Because dictionaries do not exist in 1.3, you would have to use a different way of organizing. The main script should work just fine, up until the Dictionary node. You can play with the outputs of the python or the codeblock to get the structure you want.