下一些條件,篩選出要的物件
Dim collector = New FilteredElementCollector(doc).OfClass(GetType(Pipe))
Dim provider As New ParameterValueProvider(New ElementId(CInt(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS)))
Dim rule As New FilterStringRule(provider, New FilterStringContains,"包含文字",False)
Dim filter As New ElementParameterFilter(rule)
collector.WherePasses(filter).ToElementIds()
另一種寫法
Dim collector = New FilteredElementCollector(doc)
collector.OfClass(GetType(Pipe))
Dim query = From elem In collector
Where elem.ParametersMap.Item("備註").AsString.Contains("P1~P2")
Select elem