How do I get the Id
of a parameter, say Comments
?
I want to filter all elements having a specific parameter value.
commentPara = BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS
filterRule = ParameterFilterRuleFactory.CreateEqualsRule(commentPara.Id, "Hello", True)
pFilter = ElementParameterFilter(filterRule)
FilteredElementCollector(doc).WherePasses(pFilter).ToElements()
OUT = commentPara.Id
@theshysnail ,
Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018
you are looking for this node?
1 Like
Yeah, is it possible to do it with Revit API inside the Python Script?
BuiltInParameter is Enum type , please input parameter of element,
CreateEqualsRule request input to parameter of element not BuiltInParameter
Sample like this :
pra = element.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS)
praid = pra.Id
filterRule = ParameterFilterRuleFactory.CreateEqualsRule(praid , "Hello", True)
3 Likes
@chuongmep ,
yeah that works
element = UnwrapElement(IN[0])
pra = element.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS)
praid = pra.Id
filterRule = ParameterFilterRuleFactory.CreateEqualsRule(praid , "Hello", True)
OUT = praid
1 Like
Thanks. So you need an element to act as a placeholder to get the parameter? Then as in the image below, I can get all elements, irrespective of category, which follows the filter.
element = UnwrapElement(IN[0])
para = element.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS)
filterRule = ParameterFilterRuleFactory.CreateEqualsRule(para.Id, "Hello", True)
pFilter = ElementParameterFilter(filterRule)
elem = FilteredElementCollector(doc).WherePasses(pFilter).ToElements()
OUT = elem