FilteStringContains

Hi, I´m trying to collect all walls that have a Type Name that Begins with “Revestimiento”. I´m trying to do this with python, because i´m practicing.

When I use FILTERSTRINGCONTAINS it gives me an error, I think the args* Im giving are wrong. I searched in Revit API docs, but the detail of the arguments to be delivered does not appear.

Preformatted text

#COLECTAR TODOS LOS ELEMENTOS DE UNA CATEGORIA QUE CUMPLEN CON CIERTO PARAMETRO ( ELEMENT PARAMETER FILTER)

import clr

clr.AddReference('RevitAPI')

from Autodesk.Revit.DB import *

import Autodesk

clr.AddReference('RevitNodes')

import Revit

clr.ImportExtensions(Revit.GeometryConversion)

clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')

from RevitServices.Persistence import DocumentManager

from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

bip = BuiltInParameter.ALL_MODEL_TYPE_NAME

provider = ParameterValueProvider(ElementId(bip))

evaluator = FilterStringEquals()

rule = **FilterStringContains(provider, evaluator, "Revestimiento", False)**

filter = ElementParameterFilter(rule)

walls = FilteredElementCollector(doc).OfClass(Wall).WherePasses(filter).ToElements()

OUT = walls

You don’t need the semicolon for python. Start by removing those.

Then maybe see here for reference:

1 Like