Surrounding elements


I am trying to get the visible sections in a current view i thought GetSurroundingElements do this, but it doesn’t work with sections or views.
How do i get the visible sections in a current view?


in Python you can ry using a Collector with Built-in Category of ‘OST_Sections’

In addition to @ashwinash112’s post, you can try this python.
I haven’t tested it yet.

doc = DocumentManager.Instance.CurrentDBDocument

collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Sections)

ActView = UnwrapElement(IN[0])

notHiddenList =

for s in collector:
notHidden = s.IsHidden(ActView)
if(s == false):

OUT = notHiddenList

It is based on the “IsHidden” method for elements. If the element is not hidden in the active view it will appear on the list “notHiddenList”.

I am not familiar with Python jet, so i tried your code but get error "unexpected token ‘’.

I just tried the code and I can’t get anything out of the sections. Walls, etc. is no problem but sections can’t. Sorry :slight_smile:

to bad thanks anyway

I did try with spring nodes too.
Springs.Collector.ElementsInViews throws an empty list too.

Try getting active view elements and filter views and then view types.

i believe that sections don’t belong to active view elements so i can’t retrieve them.

By the way what i want is to set the rebar View Visibility State only unobscured (tick on) to the sections that shows the rebar. In the pic below only in “test”, “Section 1”, “Section 2” and “Section 5”.


1 Like

Suggestion - Use section as active view and get all elements active view filter the rebar types in each section use that as reference in schedule to check or uncheck.

Thank you for your reply but as i sad before i can’t filter section in active view because the don’t exsist in the list of elements.

Sorry i didn’t explain properly,

and then find if rebar is visible in that view then name it accordingly

yes, but how i know (in dynamo) witch sections belong to the current view (section) my example is not a planview but a section view.

Sure i can ask the user to select the sections but i want dynamo to get all section in the current view (section)

Manage to figure it out.

thanks to @awilliams and @Kulkul in this topic How to get All Annotation Elements In Active View - section marks, elevation tags etc

you must not try to look for sections but have to search for views.

viewers.append(FilteredElementCollector(doc, v.Id).OfCategory(BuiltInCategory.OST_Viewers).ToElements())

thnks for your reply’s