06 Mar 2019
With the introduction of .GetWarnings()
in the Revit 2018 API, I retooled my model health scripts from scratch. For those out there with a similar mindset, here is an approachable starting point that can be easily expanded to include your desired metrics.
The following definition is an expandable framework currently outputting three data-points.
Please note that the following Python code utilizing .GetWarnings()
requires Revit 2018 or later.
# Python Node for Dynamo
# Get Warnings
# Version 0.1
# Coded by Andrew King
# http://andrewkingme.com
#
# 2019-03-05 Version 0.1
# Hello World
import clr
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
# Import DocumentManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
warnings = DocumentManager.Instance.CurrentDBDocument.GetWarnings()
descriptions = []
elements = []
for warning in warnings:
descriptions.append(Autodesk.Revit.DB.FailureMessage.GetDescriptionText(warning))
elements.append(Autodesk.Revit.DB.FailureMessage.GetFailingElements(warning))
#Assign your output to the OUT variable
OUT = warnings, descriptions, elements
The first half of the graph collects warnings and imports.
The second half writes a summary of the report to a text note on the Revit Starting View.
Expanding on this early framework- I’m thinking the end result will include a few dozen data-points, presented on the Revit Starting View, with updating available via Dynamo Player.
/AK at 03:09 UTC