Retrieve list of possible values for a parameter

Retrieve list of possible values for a parameter

mikkelnymand4EMUM
Participant Participant
1,036 Views
2 Replies
Message 1 of 3

Retrieve list of possible values for a parameter

mikkelnymand4EMUM
Participant
Participant

Hello, 

 

I want to retrieve a list of possible values for a given parameter. 

 

Fx. if we look at the Phase Created parameter of a given element, the parameter can only be the phases contained within the open project - how do I retrieve this list? 

 

I found this old stackoverfllow question where it doesn't seem possible, but has anything changed in that regard?

Jeremy Tammik says NO  

 

For context: 

I'm making a GUI where you can filter doors, and I want to be able to filter based on any parameter of the doors - the list of parameters I get with GetOrderedParameters() on a given door. 
When the user chooses a parameter like width I show a textbox, but if they select something like Phase Created I want to show a combobox containing the values you can choose. 

Any ideas or workaround is also greatly appreciated I feel like I've emptied out my own ideas besides hardcoding based on the phases of the project for the Phase Created parameter, but I would like a more elegant solution. 

0 Likes
Accepted solutions (1)
1,037 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni
Accepted solution

If you want to filter for doors and present a list of all existing parameter values for each parameter on each door, that can very easily be achieved by retrieving all doors and all their parameters and simply creating a list of all unique values encountered. 

  

A related and more complex task is implemented by the AdnRevitApiLabsXtra samples:

 

  

  • Labs4.cs – Lab4_2_ExportParametersToExcel: Export all parameters for each model element to Excel, one sheet per category

  

  

 

 

 

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

mikkelnymand4EMUM
Participant
Participant

Hey Jeremy 

 

Thank you for the reply. 

 

I've already successfully retrieved a list of the parameters from a door in the project, and I'm then using those values as a combobox. 

 

What I wanted to do, was display a new combobox if "Phase Created" was selected and have that combobox populated with all the current phases in the project, and if the "Mark" or "Comment" parameter was selected I wanted to display a textbox etc. 

For now I've settled with always showing a textbox, and the user have to type the relevant phase. It works fine 🙂