Key Parameters
Key Parameters
As you know we can create Key Parameter schedule in Revit to control multiple parameter values.
And if you need to automate it with Revit API - it can be a bit tricky… You see, you won't be able to provide values with text, instead you actually need to get ElementId of all possible keys, and then choose the right one.
Get Key Parameter Values
So, firstly you need to get all possible key values, and using the schedule is the best way to do that.
Here is the code snippet:
1. Get Schedule
2. Match Schedule to Key-Parameter Name
3. Sort Values in Dict
Set Key Parameter Value
Once you have a dict of all possible values, you can select the value you need and provide its Elementid as a new value in your Key-Parameter.
Here is code:
⌨️ Happy Coding!
Erik Frits