Revit API 2012 provides a new Performance Advisor Rule API with which we can access to all the existing native Revit peformance advisor rules or create our own ones and hook them up into the system.
Performance Advisor sounds a bit counfusing, as it does not really seem to have something to do with the Revit performance. In fact, the Performance Advisor Rule API provides us a way to monitor Revit modeling, warn for something not as expected, and suggest how to correct it if necessary, so Modeling Monitor may sound better.
Anyway, the naming is not the major concern here. Let’s find all existing performance advisor rules from the current Revit session. Here is the code.
PerformanceAdviser adviser = PerformanceAdviser.GetPerformanceAdviser();
using (StreamWriter sw = new StreamWriter(@"c:\temp\PerformanceAdviserRules.csv"))
{
sw.WriteLine(string.Format("ID, Name, Description, Enabled, Filter type, Check elements"));
for (int i = 0; i < adviser.GetNumberOfRules(); i++)
{
PerformanceAdviserRuleId id = adviser.GetRuleId(i);
string name = adviser.GetRuleName(i);
string desc = adviser.GetRuleDescription(i);
bool enabled = adviser.IsRuleEnabled(i);
ElementFilter filter = adviser.GetElementFilterFromRule(i, CachedDoc);
bool check = adviser.WillRuleCheckElements(i);
sw.WriteLine(string.Format("{0}, \"{1}\", \"{2}\", {3}, {4}, {5}", id.Guid.ToString(), name.Replace(',', ';'), desc.Replace(',',';'), enabled, filter==null?"N/A": filter.ToString(), check));
}
}
The information will be written to a CSV file. Since the performance advisor rule name and description can have comma inside, some meansures have been taken to take care of that. Here is sample output CSV content.
ID, Name, Description, Enabled, Filter type, Check elements
b37b2ae0-6eab-423d-bec7-59c5598d1c82, "View clipping is disabled", "View clipping is disabled. View may generate graphics for extraneous element; taking extra time.", True, Autodesk.Revit.DB.ElementClassFilter, True
5d4c01d2-a2c7-40aa-a29e-f9669cf5aeaa, "Interior categories are enabled in 3D view", "Large 3D view has interior categories enabled. It may cause Revit to spend extra time generating graphics for many obscured objects.", True, Autodesk.Revit.DB.ElementClassFilter, True
10c1bac3-9b90-4772-8731-92ee7b9aca7b, "View detail level is too high", "Large view has view detail level set to "medium" or "fine". Revit will spend extra time generatin extraneous details.", True, Autodesk.Revit.DB.ElementClassFilter, True
3410389d-7ae7-4f04-9183-69cd9ef0df48, "Multiple non-overlapping loops", "Skectch that contain multiple non-overlapping loops produce complex elements with multiple disjoint solids ; that can be ususlly replaced with few smaller and simpler elements.", True, Autodesk.Revit.DB.ElementClassFilter, True
f4fdc819-9044-4785-b5e3-5a36e89b9bd9, "Sketch is too complex", "Sketch with more than 500 elements in it may take signifiacant amount of time to solve", True, Autodesk.Revit.DB.ElementClassFilter, True
90f0eae9-1840-436a-83fb-260f07d809db, "Sketch area too large", "Sketch with area greater than 200 000 square feet may slow down selection; drawing and geometric computations.", True, Autodesk.Revit.DB.ElementClassFilter, True
b85b3b89-d2a3-415a-b289-258a21d58da1, "Host contains too many inserts", "Host objects containing too many cutting inserts may take long time to update. Consider splitting such host objects into smaller pieces or using stacked walls.", True, Autodesk.Revit.DB.ElementClassFilter, True
cbb14baa-a57c-48ee-aab4-4137fcad779e, "Overlapping walls", "Overlapping walls may slow down autojoin and geometric updates. Use embedding of walls or other ediditn tools (elevation profile; wall extent) to avoid overlapping.", True, Autodesk.Revit.DB.ElementClassFilter, True
de12e3b2-92da-48f2-a893-b422cf78d6bc, "Too Large Family File", "Family file is large in size; increasing overall Revit memory consumption.", True, Autodesk.Revit.DB.ElementClassFilter, True
ad5ef4a1-78e7-4778-8390-cf095c20734a, "Many Unused Nested Families", "Families that are nested inside other families and not instantiated are wasting memory", True, Autodesk.Revit.DB.ElementClassFilter, True
1827be73-62d8-468b-8553-7606450f401f, "Too Many elements in Family", "Family contains too many elements. Regeneration of such families is slow.", True, Autodesk.Revit.DB.ElementClassFilter, True
2f03ca4a-8959-44ed-b34e-8359931972a2, "View-specific imports in Family", "View specific imports in families are inaccessible in the project; but they still occupy memory.", True, Autodesk.Revit.DB.ElementClassFilter, True
b341a0f3-a468-4fad-8b26-39237d8486e7, "Duplicate instances", "Duplicate instances in the same place occupy memory; slow down selection and model update and cause schedules to be incorrect.", True, Autodesk.Revit.DB.ElementClassFilter, True
67c0ac52-376d-4a45-ad12-7d4df13f0b8f, "In-place family contains disjoined solids", "In-place family with disjoined solids slows down selection and model update.", True, Autodesk.Revit.DB.ElementClassFilter, True
e8c63650-70b7-435a-9010-ec97660c1bda, "Project contains unused families and types", "Unused families and types in the project are wasting memory.", True, N/A, False
86263995-19bc-4e17-9068-7974a46d0410, "Room separation line is not joined", "Unjoined room separation lines causes additional computations for room boundary computations.", True, Autodesk.Revit.DB.ElementCategoryFilter, True
fc4d3f92-60b0-4bf7-aa07-ed88c23d591b, "Too many area boundary lines", "Thousands of area boundary lines will increase model open; saving; SWC; and model updating times.", True, Autodesk.Revit.DB.ElementClassFilter, True
bc388544-7428-4491-bd03-795675ac7386, "Flipped Door Check", "An API-based rule to search for and return any doors that are face-flipped", True, Autodesk.Revit.DB.ElementCategoryFilter, True
Revit Addin Wizard (RevitAddinWizard) provides a PerformanceAdvisor Rule Creator to help implement custom performance advisor rules automatically and quickly. RevitAddinWizard can be downloaded from the Download link at the bottom of the blog index page.
Recent Comments