Hi,
i try to get all section element in view .
is it possible?
What do you mean?
All 3D Elements or 2D Elements?
KR
Andreas
I mean all “Sections” in view…

Here is my workflow for getting all the views that have a sectionline in the active view:
- Get all elements of category in view, category = views.
- String from object, get all items with the String “Element”, these are the sectionlines. (Yes thats really the only way i know to identify sectionlines)
- Element Parameter, get view name.
- List all views in project and get the views by their name.
I´m sorry, first step in my workflow is selecting section lines manually.
It was just a guess that selecting all elements in view will give you the sectionlines, but they don´t.
The All Elements in Active View node is also no help…

Some python to help ![]()
import clr
import System
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
views = FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_Viewers).ToElements()
OUT = views
Thanks,
i success getting the “Section” (maybe it the symbol itself but not the view)
how do I get the view/view id from the section?
I thought about 2 workflows but I’m feeling there is a better one and I missing something:
- I found that the view id number is +1 from the section id number. (i don’t know if it was a coincidence)
- get section name and then look for all view lists by the same name
thanks
Thats the way to go, like I´m doing it in one of the above screenshots.
Because this won`t work without a python code so i would recommend to use a code that gets the sectionlines and also gives you the views as output.
Find the code by @Hyunu_Kim here:
Very interesting in this “new” OST Category I just learned.
what is “Viewers” ??
Hi Gerhard
Thank you for this code you posted. I was wondering if it is easy to amend so it works on all views into the python node, rather than just the active view? I have tested this and it works as you say on the active view, but not on non-active views. Is it possible to ask for your thoughts/help with this?
Thank you very much!
Tim
Hello @TimGreatrex
There are a few problems to consider.
To collect section lines we have to collect elements of the builtincategory “viewers”.
This will unfortunately also collect Elevations and Callouts. After trying for years to filter them out I never found a way but now I gave it another try and I managed to filter out the Elevations at least.
This will only work on english revit due to lack of a better method. You get a sublist with corresponding views for all section lines and callouts that are found. Callouts could be filtered by name if the name always contains “Callout”.
import clr
import System
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
input_views = UnwrapElement(IN[0])
# Get all views in the document (excluding templates and system views)
all_views = FilteredElementCollector(doc).OfClass(View).ToElements()
all_views = [v for v in all_views if not v.IsTemplate and v.ViewType != ViewType.Internal]
all_corresponding_views = [] # List to hold sublists of corresponding views for each input view
for view in input_views:
corresponding_views_in_view = [] # Sublist for corresponding views in the current view
viewer_ids = set() # A set to keep track of unique viewer IDs for the current view
viewers = FilteredElementCollector(doc, view.Id).OfCategory(BuiltInCategory.OST_Viewers).ToElements()
for viewer in viewers:
type = doc.GetElement(viewer.GetTypeId())
if type.FamilyName == 'Section' and viewer.Id not in viewer_ids:
# Find the view that matches the viewer's name
for v in all_views:
if v.Name == viewer.Name:
if v not in corresponding_views_in_view:
corresponding_views_in_view.append(v)
break
viewer_ids.add(viewer.Id) # Add the ID to the set to keep track of it
all_corresponding_views.append(corresponding_views_in_view) # Add the sublist to the main list
OUT = all_corresponding_views
Hi Gerhard
Thank you so much for this! This worked nicely. Very kind of you to take the time to update the code.
The only thing I have noticed is it does not accept list level L2. Is this easy to update, can I do this?
Thank you very much again
Best
Tim
Python does not have a concept of list levels. If you want to control data in that way you should wrap the Python in a custom node, and deploy/distribute that.
Hi Jacob. Thank you very much for this, I will add into a custom node. Thanks for this.
Cheers
Tim





