I worked out some Python scripts using FilteredElementCollector and a FilterStringRule.
Always worked out well.
For example here i create a list with the rectangle ducts :

bip = BuiltInParameter.RBS_CALCULATED_SIZE
provider = ParameterValueProvider(ElementId(bip))
evaluator = FilterStringContains()
rule = FilterStringRule(provider,evaluator,“x”,False)
filter = ElementParameterFilter(rule)

collector= FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_DuctCurves)
coltype = collector.WherePasses(filter).ToElements()

But i also want a list without rectangle ducts. In the revit api there is no FilterStringNotContains().
Anybody have an approach for this?

Thanks alot.

Split this up into a loop to query the string value rather than using a collector filter. Use a For loop for each element in the collector and get the parameter value for that element. Query if the string value contains the given string. You can then use an If condition to split the elements into two groups: contains and does not contain.

I tried it a similar way.

But i need the elements not the string value. At first it seemed the script works , but at a closer look i noticed the value’s it needs to set are at the wrong element.
Thats why i tried with python to get the correct elements at first, without succes.

Filter the element, not the value.

1 Like

Sure. How? :slight_smile:

ah never mind got it ! Thanks alot.