Collect Elements visible inside Crop Region/View

Hello All,

Does anyone know a work around to collect elements in input view visible inside Crop Region/View of a plan view?

Regards,
Atharva Purohit.

Why not get the elements inside the view you’re referencing instead of the view showing that view’s call out?

Hi Jacob,

Please refer to the image, there can be other elements also in the view, but hidden by the crop.

Is there any way we can just fetch the visible elements?

Regards,
ap

In this case I’d used a Python node with a filtered element collector. Something like this should get you started (modified from this link: dynamoPython/filteredElementCollectorAllElements.py at master · Amoursol/dynamoPython · GitHub)

import clr # CLR ( Common Language Runtime Module )
clr.AddReference("RevitServices") # Adding the RevitServices.dll special Dynamo 
# module to deal with Revit
import RevitServices # Importing RevitServices
from RevitServices.Persistence import DocumentManager # From RevitServices import 
# the Document Manager
clr.AddReference("RevitAPI") # Adding the RevitAPI.dll module to access the Revit 
# API
import Autodesk # Here we import the Autodesk namespace
# From the Autodesk namespace - derived down to the Revit Database, we import only 
# the Filtered Element Collector and BuiltInCategory classes
from Autodesk.Revit.DB import FilteredElementCollector

# Here we give the Revit Document a nickname of 'doc' which allows us to simply 
# call 'doc' later without having to type the long namespace name 
doc = DocumentManager.Instance.CurrentDBDocument
view = doc.ActiveView
# To create a Filtered Element Collector, we simply type the PINK part of 
# RevitAPIDocs.com ( FilteredElementCollector ), wrap it inside of Parenthesis and 
# then call the ORANGE part of RevitAPIDocs ( Document, View ). We are running 
# multiple filters here: The 'OfClass', 'OfCategory' and 'Where Element Is Not 
# Element Type'. We then cast it to Elements so we can use it in Dynamo.
elementCollector = FilteredElementCollector( doc, view.Id ).WhereElementIsNotElementType().ToElements()

# To get our results back inside of Dynamo, we need to append a list to the OUT port
OUT = elementCollector```
1 Like

Thank you, I’ll try and revert.