Working with File Warnings in Multiple Revit Documents

hi everyone - I would like to use Bang! in my script for batch maintaining revit files in the background.

To do so I would need an input for the opened documents.

Would it be possible to implement it?

I went ahead and made this a new topic

I won’t be able to get you a perfect solution, but, Bang will not support this. You are going to need to use a custom Python node to achieve this. I would also say to provide more information regarding how you are opening the documents in batch.

This python script would iterate along an input list of Autodesk.Revit.DB.Documents:

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure 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


def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]

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

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

allWarnings = []

for d in documents:
	warningsForThisDocument = []	
	warningsForThisDocument.append(d.GetWarnings())
	allWarnings.append(warningsForThisDocument)
OUT = allWarnings
1 Like

Thank you.

To use your script I just have to create a python node and past it in, right?

My graph basically looks like this: