Extract Warnings using Dynamo

@johan.germishuys
Thanks to your sample files, I found that Revit Warning also use “GetAdditionalElements” in HTML Warning Export. I have improved your python code, and works well.

import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

warnings = doc.GetWarnings()
descriptions = []
elements = []

for warning in warnings:
    descriptions.append(warning.GetDescriptionText())
    ids_temp = warning.GetFailingElements()
    elements_temp = []
    for id in ids_temp:
        elements_temp.append(doc.GetElement(id))
    aids_temp=warning.GetAdditionalElements()
    for id in aids_temp:
        elements_temp.append(doc.GetElement(id))
    elements.append(elements_temp)

OUT = descriptions, elements
5 Likes