The tool to report performance problems in a given document.
Inheritance Hierarchy
System.ObjectAutodesk.Revit.DB.PerformanceAdviser
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public class PerformanceAdviser : IDisposable
The PerformanceAdviser type exposes the following members.
Properties
| Name | Description | |
|---|---|---|
| IsValidObject | Specifies whether the .NET object represents a valid Revit entity. |
Methods
| Name | Description | |
|---|---|---|
| AddRule | Adds a performance adviser rule to the list of rules. | |
| DeleteRule | Deletes a performance adviser rule from the list of rules. | |
| Dispose | Releases all resources used by the PerformanceAdviser | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| ExecuteAllRules | Executes all rules in the list on a given document. | |
| ExecuteRules(Document, IList<PerformanceAdviserRuleId>) | Executes selected rules on a given document. | |
| ExecuteRules(Document, IList<Int32>) | Executes selected rules on a given document. | |
| GetAllRuleIds | Retrieves an enumeration of rule Ids. | |
| GetElementFilterFromRule(Int32, Document) | Retrieves a filter to restrict elements to be checked. | |
| GetElementFilterFromRule(PerformanceAdviserRuleId, Document) | Retrieves a filter to restrict elements to be checked. | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetNumberOfRules | Retrieves number of performance adviser rules in the list. | |
| GetPerformanceAdviser | Returns the only instance of PerformanceAdviser in the Application. | |
| GetRuleDescription(Int32) | Retrieves the description of the rule. | |
| GetRuleDescription(PerformanceAdviserRuleId) | Retrieves the description of the rule. | |
| GetRuleId | Retrieves an id of a rule for a given index in the list. | |
| GetRuleName(Int32) | Retrieves the name of the rule. | |
| GetRuleName(PerformanceAdviserRuleId) | Retrieves the name of the rule. | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| IsRuleEnabled(Int32) | Retrieves an enabled/disabled status for the given rule. | |
| IsRuleEnabled(PerformanceAdviserRuleId) | Retrieves an enabled/disabled status for the given rule. | |
| PostWarning | Reports a problem detected during execution of a rule. | |
| SetRuleEnabled(Int32, Boolean) | Retrieves an enabled/disabled status for the given rule. | |
| SetRuleEnabled(PerformanceAdviserRuleId, Boolean) | Retrieves an enabled/disabled status for the given rule. | |
| ToString | Returns a string that represents the current object. (Inherited from Object) | |
| WillRuleCheckElements(Int32) | Reports if rule needs to be executed on individual elements. | |
| WillRuleCheckElements(PerformanceAdviserRuleId) | Reports if rule needs to be executed on individual elements. |
Remarks
Class is an application-wide singleton that performs a dual role: it is a repository of rules to run in order to detect potential performance problems as well as an access point to execute checks.Example
C#
//Get the name of each registered PerformanceRule and then execute all of them. foreach (PerformanceAdviserRuleId id in PerformanceAdviser.GetPerformanceAdviser().GetAllRuleIds()) { string ruleName = PerformanceAdviser.GetPerformanceAdviser().GetRuleName(id); } PerformanceAdviser.GetPerformanceAdviser().ExecuteAllRules(document);
VB
'Get the name of each registered PerformanceRule and then execute all of them. For Each id As PerformanceAdviserRuleId In PerformanceAdviser.GetPerformanceAdviser().GetAllRuleIds() Dim ruleName As String = PerformanceAdviser.GetPerformanceAdviser().GetRuleName(id) Next PerformanceAdviser.GetPerformanceAdviser().ExecuteAllRules(document)
