Revit api. Retrieve all parameters and categories #183
Replies: 6 comments 7 replies
-
@Nice3point it is awesome ! |
Beta Was this translation helpful? Give feedback.
-
Hi @Nice3point , it look like not working in Revit 2025 ? |
Beta Was this translation helpful? Give feedback.
-
I can confirm it working awesome, thank @Nice3point |
Beta Was this translation helpful? Give feedback.
-
just to clarify: these are the unique parameter names; the parameters themselves are not unique, of course, or, rather, several different parameters may share the identical display name. |
Beta Was this translation helpful? Give feedback.
-
this is a fundamental parameter design issue. the ongoing project to convert the revit parameter definitions to some kind of globally unique repository that can be shared across all BIMs world-wide should resolve this. i searched on the roadmap and did not find exactly what i was expecting, but this thing here comes close: https://portal.productboard.com/mhf8vce9ubfupbhkfomayvi1/c/61-parameters-classification-taxonomy |
Beta Was this translation helpful? Give feedback.
-
I've handled this issue, RevitLookup will now display the name as in Enum. However, when going to "explore members" it will still be a one parameter as designed in the API The fix requires an additional call to GetNames, since in C# GetValues casts them to the same name var parameters = Enum.GetValues<BuiltInParameter>();
var parameterNames = Enum.GetNames<BuiltInParameter>();
var result = new List<UnitInfo>(parameters.Length);
for (var i = 0; i < parameters.Length; i++)
{
...
var parameter = parameters[i];
var name = parameterNames[i],
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I recently came across a problem from my business partner who wanted to get all the built-in Revit parameters to extract metadata such as data type, units, storage type, etc. As we know, this is not possible using Autodesk's public API.
Similar situation with categories, we can't get all the built-in categories, the only available way is to get them from the document settings, but it contains a very truncated list
Solution
We can use private code using reflection and pointers, we only need a document.
The point of the method is not to get them but create it.
Example code to get all parameters:
Example code to get all categories:
Result
As a result, we have created all the parameters and all the categories of the entire Enum
Parameters:
Categories:
Limitations
Created parameters have no binding to the element, and consequently have no value, only metadata
Beta Was this translation helpful? Give feedback.
All reactions