"Z offset value", 'Elevation at top', 'Elevation at bottom', "Height offset from level", "Top offset", "Base offset", "Unconnected height" ]: # double values try: target_parameter_value = ele.Parameter[target_parameter].AsDouble() except: forms.alert("Parameter {0} not found in {1}".format( selected_switch_parameter, category_name), exitscript=True) param_id = DB.ElementId(target_parameter) param_prov = DB.ParameterValueProvider(param_id) param_equality = DB.FilterNumericEquals() # equality class for double value_rule = DB.FilterDoubleRule(param_prov, param_equality, target_parameter_value, 1e-5) param_filter = DB.ElementParameterFilter(value_rule) elementids = DB.FilteredElementCollector(doc, curview.Id)\ .OfCategory(target_category)\ .WhereElementIsNotElementType()\ .WherePasses(param_filter)\ .ToElementIds() # select category based on the rule if len(elementids) > 1: # there atleast one element selected uidoc.Selection.SetElementIds(elementids) else: forms.alert("Match Not Found", exitscript=True) else: # value Strings """This param equality for this type is not available so we go for for loop""" valuestring = True try:
filter_string_begin_with = DB.FilterStringBeginsWith() # Filter for specific string string_begins_with_12_Base = DB.FilterStringRule(family_name_provider, filter_string_begin_with, '12 BASE', 1) #Filter for specific string string_begins_with_12_Tall = DB.FilterStringRule(family_name_provider, filter_string_begin_with, '12 Tall', 1) #Filter for specific string string_begins_with_12_Case = DB.FilterStringRule(family_name_provider, filter_string_begin_with, '12 CASE - BASE', 1) # Create Filter strings p_fil_a = DB.ElementParameterFilter(string_begins_with_12_Base) p_fil_b = DB.ElementParameterFilter(string_begins_with_12_Tall) p_fil_c = DB.ElementParameterFilter(string_begins_with_12_Case) #Create filter list filter_list = [p_fil_a, p_fil_b, p_fil_c] # Determine if one of the filters has items that pass param_filter = DB.LogicalOrFilter(filter_list) # Collect items that pass parameter filetered above cwk_coll = DB.FilteredElementCollector(doc)\ .WherePasses(param_filter)\ .WhereElementIsNotElementType() # Collect items with the parameters filtered above all the way to Element IDs\ cwk_sel = DB.FilteredElementCollector(doc)\