Revit API 2012 provides a new Performance Advisor Rule API with which we can access to all the existing native Revit peformance advisor rules, execuate any of them, and create our own ones when necessary and hook them up into the system.
When creating our Performance Advisor Rules, we may want to brand them so that we can put all those native ones aside and call only our own up when necessary. However, the Revit API 2012 does not provide us a straightforward. The current situation is that when some custom Performance Advisor Rules have been created and hooked up into the system they are all mixed up in the PerformanceAdviser and all rules either native or custom will be returned by the GetAllRuleIds() call.
So is there a good way to disguish Revit native Performance Advisor Rules from custom ones?
One way is to dump out all those native rules and keep them somewhere for query, either in an external text file as we did before, or in an internal static list in our addins beforehand, and use the list to filter out all third party ones when necessary. However, it has some shortcomings as we can imagine. Revit may add some more native rules from timeto time and we cannot be sure that those rules do not change in different versions, flavors and languages.
Ok, let us work out our own and good way then, using a good GUID naming convension. I would suggest this, using a group of digits/letters as your band in the second group of the GUID. For example, ABCD can serve for this goal. Here are some sample such GUIDs:
71B923D4-ABCD-4BE4-861A-3A26146EF3F0
398A60AB-ABCD-48C1-ADEA-70009C3DFAC9
031E215A-ABCD-4AB1-9D73-2C52872DA802
This approach has its potential issue as well. Automatic GUIDs can also have the brand by chance, but one sure thing is the chance is rather slight. So the approach is reliable enough.
Keeping this in mind, we are going to create our own Performance Advisor Rules next time. Stay tuned!
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