Hi All,
I’m trying to retrieve an element from a list by specifying its name, but I’m encountering the following error:
What is strange is that I can append the Names list with item names by typing the code Names.append(shaft.Name)
, as shown in the output below. However, I cannot retrieve the specific item I’m looking for using the if statement ( see the 2nd image and the code below ) !?
all_Shafts = FilteredElementCollector(doc).OfCategory(BuiltInCategory. OST_StructuralFraming).WhereElementIsNotElementType().ToElements()
for shaft in all_Shafts:
if shaft.Name == Shaft2:
final_shaft = shaft
else:
final_shaft = all_Shafts[-1]
OUT = all_Shafts, final_shaft
Thanks in advance for your help.