Setting Built in Parameter by using a Variable value

Right, if you simply pass in a string it is not a BuiltInParameter. Here’s a rewritten example:

import clr
from Autodesk.Revit.DB import BuiltInParameter
from System import Enum


names = Enum.GetNames(BuiltInParameter)
values = Enum.GetValues(BuiltInParameter)

bip_dict = dict(zip(names, values))
# Returns a BuiltInParameter given its name (key)
bip = bip_dict[key]

# Assume wall is a valid Element
param = wall.Parameter[bip]
param_value = param.AsString()

In your above example, BaseMatch_Parameter_Key is not a member of the BuiltInParameter Enum. Members are accessed by their name, such as BuiltInParameter.ALL_MODEL_TYPE_COMMENTS, but this is not a string. If that were the case, it would be written as BuiltInParameter.“ALL_MODEL_TYPE_COMMENTS”. So, it isn’t possible to replace one of the member names with a string in that manner. The process I have illustrated above creates a dictionary where the keys are the member names and the values are the corresponding BuiltInParameter values.