All Elements of Type in View

Is it possible to get a list of all the elements of an element type in a view?
Import Instances is an element type, but I can’t seem to get a list of them without using the node “All Elements in Active View”. Pulling every single element in a view is time consuming. It is much faster to pull all elements of a category in a view, but importInstances doesn’t seem to apply to any normal category. Is there a way to do this more directly, without filtering a much larger list?

Hi @daniel1,

It is possible with a collector:

import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

view = UnwrapElement(IN[0])
elementType = IN[1]

elements = FilteredElementCollector(doc,view.Id).OfClass(elementType).ToElements()

OUT = elements


SelectByElemTypeAndView.dyn (6.9 KB)

1 Like

@Alban_de_Chasteigner, you are an amazing person! Thankyou.
You’d think that “All Elements of Type in View” would be a standard node, but Lords of Dynamo have not seen fit to add it just yet.

1 Like