- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
Please can someone advise on how to construct a filter that will find elements that have been "hidden by element" in a view?
I have some working code that finds all elements in the current design option and then iterates through each to find which are hidden, but there must be a way to construct an element parameter filter that will be quicker but I can't figure out how to build using the element.ishidden(vw) parameter.
Dim doc As Autodesk.Revit.DB.Document = commandData.Application.ActiveUIDocument.Document
Dim vw As Autodesk.Revit.DB.View = doc.ActiveView
Dim CollectorView As FilteredElementCollector = New FilteredElementCollector(doc)
Dim activeOptId As ElementId = Autodesk.Revit.DB.DesignOption.GetActiveDesignOptionId(doc)
'create an ElementDesignOption filter
Dim Filter_Option As New ElementDesignOptionFilter(activeOptId)
CollectorView.WherePasses(Filter_Option)
Dim Iter_Elements As IEnumerator = CollectorView.GetElementIterator
'iterate through all the elements to find hidden elements
Do While Iter_Elements.MoveNext()
If (Not (Iter_Elements.Current) Is Nothing) Then
Dim e As Element = Iter_Elements.Current
If e.CanBeHidden(vw) Then
If e.Id <> vw.Id Then 'don't include the view border if hidden
If e.IsHidden(vw) Then
Thanks!
Solved! Go to Solution.