HI Everyone,
I’m trying to collect elements hidden in views for which I tried
- collect elements from prject
- Use a python scipt that can find hidden elements in view
It works fine for elements in active view but if I try to collect all the elements from project,
"How do I filter those elements which do not have a specific attribute named “IsHidden” ?
Warning I get when I try run the script:
Script:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
def toList(obj):
if hasattr(obj, '__iter__'): return obj
else: return [obj]
elements = toList(UnwrapElement(IN[0]))
views = toList(UnwrapElement(IN[1]))
elementsHidden = []
elementsNotHidden = []
for view in views:
for element in elements:
if element.IsHidden(view) is True:
elementsHidden.append(element.Id)
else:
elementsNotHidden.append(element)
OUT = elementsHidden
Any leads can be of real help