My team is developing a plugin for Autodesk Revit. We would like to provide the user with a custom parameter (project or shared) that appears in the Properties panel of all (or most) structural elements, that lets the user select from one of a small set of pre-defined values. i.e. a parameter of type "enum". For the sake of example, pretend that we want to add a parameter whose values can be "Red", "Yellow", "Blue", and "Green", whose meaning is only relevant within the context of our plugin.
This is, to our surprise, not at all straightforward, to the point that I have not yet found a code example that demonstrates how to do it. I assume it's a rare use case in the Revit world.
One promising lead is the "Family Type" parameter type, but it is unclear how to use this to our ends. It's also possible, from a mention in another forum post, that a key schedule would help. If anyone can explain how these mechanisms could be used to this end, please provide any and all suggestions.
From blog posts, I gather that a text parameter will display, as a convenience, a pulldown containing all values for the parameter already existing in the model, but this does not completely solve our problem - we need the user to able to assign values without those values already existing in the model.
A lesser solution is to make the parameter an integer or text value, and have the user manually type the value when necessary. Less than ideal, in part because the user might type it incorrectly. We would like them to be able to simply select one of our pre-defined values from a pulldown.
Another lesser solution is a set of Yes/No parameters, one for each enum value. Poses a problem if the user selects more than one for a single element by accident.
Does anyone know how one creates such an "enum" pulldown parameter?
We will figure it out, but any help here would greatly expedite the research.