Enum and Element Id storage Parameter

Enum and Element Id storage Parameter

gopinath.rajendran
Enthusiast Enthusiast
844 Views
4 Replies
Message 1 of 5

Enum and Element Id storage Parameter

gopinath.rajendran
Enthusiast
Enthusiast

Is there a way to identify if a parameter is storing an Enum type value and then collect all possible values (translated display values as well) for that parameter?

Is there a way to identify and list all possible values for parameters that store ElementId values?

 

 

0 Likes
845 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Yes and yes.

  

Look at the Parameter object Definition StorageType:

  

   

Afaik, enum values are stored as integers. The enumeration members are listed in the Revit API documentation. For instance, here is the link to the BuiltInCategory enumeration:

  

  

Element id values are normally limited to a specific class of elements, like wall types or something. You can retrieve a list of all possible element ids by using as filtered element collector and optionally filtering for the appropriate class of elements.

   

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

gopinath.rajendran
Enthusiast
Enthusiast

This is not what I'm looking for. For example, if the 'Detail Level' parameter has enum values, I want to retrieve the related enum values from that parameter. Also, how can I determine the specific class of elements from a parameter if the parameter's storage type is ElementId?
 I am looking for a way to access them through the revit api.

gopinathrajendran_1-1724915476119.png

 

 

 

0 Likes
Message 4 of 5

jeremy_tammik
Alumni
Alumni

For the detail level, one possibility is to manually set the different detail levels in the view and use RevitLookup to explore what integer value and string results. I am not aware of a global pure API solution to access all possible values.  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 5

TripleM-Dev.net
Advisor
Advisor

Hi @gopinath.rajendran,

 

You can take a look at the LabelUtil methods.

The Detail level descriptive name per Id isn't one of them although. Many of those type of properties don't have a Label or Enum value, guess some builtin const values.

 

If you need the description value of the integer values for user selection, I suggest mapping the values yourself.

For instance Location Line of walls is also one of those like detail level and will mostly be fixed mappings. Just check with new Revit versions if they changed anything.

 

For just displaying the values, evaluate the Parameter to show the int value or it's AsValueString.

What I do for displaying readable values, is to inspect the StorageType, if it's a integer I check for it's dataType.

If it's a invalid datatype I check it's AsValueString, if that's not empty I use that else the integer value.

 

- Michel