doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
app = __revit__.Application
rvt_year = int(app.VersionNumber)
def get_filled_region(filled_region_name):
"""Function to get FilledRegionType by Name using Revit API Filters"""
param_id = ElementId(BuiltInParameter.ALL_MODEL_TYPE_NAME)
pvp = ParameterValueProvider(param_id )
condition = FilterStringEquals()
if rvt_year < 2022:
fRule = FilterStringRule(pvp, condition, filled_region_name, True)
else:
fRule = FilterStringRule(pvp, condition, filled_region_name)
my_filter = ElementParameterFilter(fRule)
return FilteredElementCollector(doc).OfClass(FilledRegionType)\
.WherePasses(my_filter).FirstElement()