Get all the warnings types

Hi,
I would create a sheet on revit which presents all types of warnings with their counts. I get all the warnings but I can’t filter the list and count the duplicates.

Anyone have an idea please ?

In the python script, i tried to filter the list, but in vain.

@ilyes.aissati ,

check out this node

or you can deal with the .html

fil01 = DSOffice.Data.ImportCSV(errRpt);
rpt01 = String.Remove(List.DropItems(List.DropItems(String.Concat(List.Transpose(fil01)),3),-1),0,4);

//Elements
eID01 = List.TakeEveryNthItem(rpt01,2,0);
eID02 = String.AllIndicesOf(eID01," id ");
eID03 = String.ToNumber(String.Substring(eID01,eID02+3,7));
elm01 = Revit.Elements.ElementSelector.ByElementId(eID03);

//Error Messages
err01 = List.TakeEveryNthItem(rpt01,2,1);
err02 = String.IndexOf(err01,">")+3;
err03 = String.LastIndexOf(err01,"<") - String.IndexOf(err01,">") - 5;
err04 = List.TakeItems(String.Substring(err01,err02,err03),List.Count(eID03));

KR
Andreas

Use, an awesome package called Bang from @john_pierson .

the first node isn’t working for warnings (the parameter name doesn’t match), and with the .html, i doesn’t find the "Dictionary {Element : Warning }.

Thank you for ur help.

I use it but the package can’t get the warnings types, it shows all warnings regardless of their types.

My goal is to extract a list of the types, like this :
image

If someone know how to get the input list of “All Warnings of Types”, it can help me.

Get all the warnings as a first step, and see what options you have with those elements.

Look my first image, i already did this but i can’t sort the warnings by their types.

If you take one warning out, what do you see when you get the element’s parameters?

Like this ?


It tells me that warning isn’t an element.

Ah. Warnings do t have a wrapper when gathered like that. Check Crumple for options on what you can do with them.

Does this work?

Warnings:

#Sean Page, 2023
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

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

doc = DocumentManager.Instance.CurrentDBDocument

OUT = doc.GetWarnings()

Descriptions:

#Sean Page, 2023
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

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

doc = DocumentManager.Instance.CurrentDBDocument


#Preparing input from dynamo to revit
warnings = UnwrapElement(IN[0])

OUT = [e.GetDescriptionText() for e in warnings]
2 Likes

And if you want the elements you can get them like this:

#Sean Page, 2023
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

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

doc = DocumentManager.Instance.CurrentDBDocument


#Preparing input from dynamo to revit
warnings = UnwrapElement(IN[0])

OUT = [[doc.GetElement(x) for x in e.GetFailingElements()] for e in warnings]

Thank you very much for your help. It works for warnings with exactly the same description in the list, however, there are still warnings with different descriptions but which have the same type, which does not really help my situation, since I was at this level before asking for help.

1 Like

I do this to have the element but it doesnt help me to solve my problems.

Not sure exactly what you mean by “Type” of error, but the unique characteristic of a warning is the FailureDefinitionId:

FailureId:

#Sean Page, 2023
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('System')
from System.Collections.Generic import List

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

doc = DocumentManager.Instance.CurrentDBDocument


#Preparing input from dynamo to revit
warnings = UnwrapElement(IN[0])

OUT = [e.GetFailureDefinitionId().Guid for e in warnings]

Okay, this is exactly what I am looking for. Sorry for the use of the wrong lexicon, I’m new to Dynamo (1 week of training). I will now try to extract the description of the FailureDefinitionId and the goal will be achieved.

thank you again.

1 Like

This is how you can get an list of ALL Warnings in a Revit Session:

#Sean Page, 2023
import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.ApplicationServices import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
reg = Application.GetFailureDefinitionRegistry()
TransactionManager.Instance.TransactionTaskDone()

OUT = [[x.GetId().Guid,x.GetDescriptionText()] for x in reg.ListAllFailureDefinitions()]
1 Like