Here is a recurring question that we have answered in depth a few times over, on binding a shared parameter to a given category, so the answer mainly consists of pointers to past discussions:
- How to add a shared parameter to revision?
- Determine the category
- Binding to the category
- Implementation sample
How to Add a Shared Parameter to Revision?
Is there an example to add a shared parameter to a Revision record?
How do I add more information to the Revision record in the parameters?
Determine the Category
Afaict from experiments in the distant past, you can add a shared parameter to almost any category.
Does a category exist for revisions?
If you don't know off-hand, you can tell in several different ways:
- Explore the existing revision that you just created using RevitLookup; what category does it have?
- Look at the definition of the built-in category enumeration in Visual Studio and search for 'revision'.
- Look at the definition of the built-in category enumeration in the Revit API help documentation and search for 'revision'.
I did the latter, looked at
the BuiltInCategory
enumeration documentation.
That shows me that the built-in category OST_Revisions
exists, so all is well so far.
Binding to the Category
Next, I suggest you check out the ADN Xtra labs.
Of special interest in your case is the external command Lab4_3_1_CreateAndBindSharedParam in the module Labs4.cs that shows how to create and bind a shared parameter.
As you can see from
the comments on that command,
I have used it repeatedly in the past to test creating a shared parameter for various categories, both built-in ones such as OST_Revisions
and dynamically generated ones, such as for an imported DWG file.
Search The Building Coder blog posts for Lab4_3_1_CreateAndBindSharedParam to see detailed discussions of some of those experiments:
- Adding a Shared Parameter to a DWG File
- Model Group Shared Parameter
- Exporting Parameter Data to Excel, and Re-importing
- Sydney Revit API Training
- Retrieving Element Properties
- The FireRating Revit SDK Sample and ADN Xtra Labs
- Material Shared Parameters and ADN Xtra Labs
Implementation Sample
Once you have ascertained that you can bind a shared parameter to the category of interest, I assume your next question will be how to do so in a simple and efficient manner.
I implemented one approach for the ExportCncFab add-in.
It is discussed in three posts by The Building Coder, listed in the topic group on splitting an element into parts.
The third of those explores and implements binding and storing shared parameter data.