Warnings from linked models

Hi

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.

Thank you in advance.

dont know if it works for linked models, but have you tried the Bang package?

Yes I have tried the Bang! package, it does not include warnings from Revit links - unfortunately.

@klausvm
Unfortunate indeed. @john_pierson
Maybe you could try to batch opening your files in the background (over night) and writing warning reports.

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.

1 Like

@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.

import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitServices')

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 = []
		warnings.append(warn.GetDescriptionText())
		for elem in warn.GetFailingElements():
			elems.append(doc.GetElement(elem))
		warnings.append(elems)
	all_warnings.append(warnings)


OUT = all_warnings

Let me know what you would want added to the list.
Edit: updated to return the actual element instead of elementid

linkedwarnings

8 Likes

@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.

Would you rather put an input on the python node that accepts the revitlinkedinstances / linked docs and then run it or run it and then filter afterwards?

For the latter, this graph will turn each linked instance into a dictionary of its warnings for which you can filter by name, etc.:


linkedwarnings.dyn (7.9 KB)

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).

1 Like

I can easily filter it afterwards or just turn of the links I don’t want processed.

This is great. But when I try to run the script, it just keeps saying “Run started…” and has been like that for 30 minutes now… Any idea why?

Would be great also to have the element id from the warning, so it’s easy to lookup and locate.

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.

linkedwarnings.dyn (7.9 KB)

Let me know if it still freezes for you.

1 Like

@kennyb6

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?

Thank you so much!

Sorry, the office was closed for Chinese New Years, just got to this. Can you explain what you mean by assigning the warnings?

No worries.
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.

This script also sometimes freezes for me.
I am using Dynamo 2 and Revit 2018.3

I don’t know which triggers cause it to freeze.

In order to use this script, I believe you cant have ANY unloaded links. The links must either be fully loaded or fully removed.

“Nulls” do not let the python script run.

1 Like

Ah that makes sense. I never put in any error testing. You can add this after the for doc in docs: line:

	if doc == None:
		continue

Hello Kenny,

What changes would i need to make to run this on Dynamo 1.3?

I find that Dynamo 2.0 is unstable and prone to crash.

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.

On second thought I will stay in 2.0.

For some reason Archilab package was causing my script to crash.

I have to rebuild without Archilab.

1 Like