isolating revit warnings by category with dynamo

Here’s a quick video on how I was able to create a simple definition in Dynamo that parses through an exported HTML file with all warnings from Revit. It filters for a specific warning type like: “Walls and Room Separation Lines overlap.” and list all elements IDs so that later I can use them to automatically isolate those elements in a view. Please watch a preview on YouTube:

Revit Warnings Parsing and Elements Isolating w/ Dynamo

Here’s what the Dynamo Definition looks like:

And here is a final result:

UPDATE (2016 02 08):

It was recently brought to my attention that these nodes simply disappeared from my package, which is not OK, but I guess it will be better to just post the source code here:

I am using a Python module called Beautiful Soup to parse the HTML file and isolate the warnings. Please download it from this link: BeautifulSoup3.2.1 Make sure that it’s installed in the following location:  C:\Program Files (x86)\IronPython 2.7\Lib\BeautifulSoup-3.2.1

This should do the trick!

Here’s source code for the Warning Parser:

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

# Copyright(c) 2016, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net
importclr
importsys
pyt_path=r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
lib_path=r'C:\Program Files (x86)\IronPython 2.7\Lib\BeautifulSoup-3.2.1'
sys.path.append(lib_path)
fromBeautifulSoupimportBeautifulSoup
importre
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode=IN
file_path=str(IN[0])
file=open(file_path, "r")
err_type, txt4= [], []
err_name=IN[1]
soup=BeautifulSoup(file)
tag=soup.findAll('tr')
foriintag:
txt=str(i.text)
txt2=txt.rpartition(".")
txt3=txt2[0].split(".")
#Create list of ALL error types in file
err_type.append(txt3[0])
#get strings from rows
txt4.append(str(txt2[-1]))
#get total number of warnings
total_warnings=len(err_type)
#get number of warnings for type specified
type_warnings=err_type.count(err_name)
#parse the properties cell for element IDs
pattern=re.compile(r"\bid\s*?(\d+)")
ids= ["; ".join(pattern.findall(item)) foritemintxt4]
#create filtered sets that contain only specified type of error
err, id=set(), []
fori, jinzip(err_type, ids):
ifi==err_name:
err.add(i)
id.append(j)
#combine all ids into one string for use with Revit
final_ids=list(id)
str_ids=' ;'.join(str(elem) foreleminfinal_ids)
#create a list of individual ids
list_ids=set(str_ids.replace(" ", "").split(";"))
#define outputs
OUT=err, list_ids, total_warnings, type_warnings

view raw warningParser.py

The rest of the nodes that you see on canvas are from Archi-lab.net package. Please download version from 2016.02.08.

Good luck!