Hi all,
I’m new to python and want to filter a specific floor type in a view. Now my script works when I just use a string node. Although the problem is that I’m working with the Data Shape package with user input so Dynamo creates a list.
Does anyone could help me out?
Thanks in advance!
ERROR:
File “”, line 33, in
TypeError: expected str, got List[object]
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
user_input = UnwrapElement(IN[0])
collector = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType().ToElements()
floors = []
for f in collector:
if f.Name.Contains(user_input):
floors.append(f)
OUT = floors