DaveGrohl
DaveGrohl

Reputation: 35

How to Select All Cut Elements in Autodesk Revit Across Various View Types?

I am working on a script in Autodesk Revit, and I need assistance in selecting all elements within the current view that are cut, irrespective of the view type (e.g., floorplan, section, elevation, 3D, etc.). I want the selection to be independent of whether the view has an active crop region or not.

Obviously Revit already assigns hatches to elements based on whether they are cut or not, so I believe there should be a straightforward solution to identify and select these elements programmatically.

I've searched through the documentation and forums but haven't found a clear answer. Can anyone provide guidance or share a code snippet that accomplishes this task? Your help will be greatly appreciated!

Upvotes: 1

Views: 406

Answers (2)

Mostafa Tarek Yassien
Mostafa Tarek Yassien

Reputation: 532

I had a similar workflow with dynamo that might help. First you get the level associated with the view and you get the cut plan from the view range of the view. Then create an XY Plan with the elevation of the level + the cut plan offset from the view range. intersect this plan with all elements in the model, the output list is all the elements that are cut by that view. You have to take into consideration if the model is shared or not and the relativity of the elevation of the level. Hope this helps.

Upvotes: 0

Jeremy Tammik
Jeremy Tammik

Reputation: 8294

I doubt that the Revit API provides direct access to the cutting and hatching predicate that you refer to, so it may be a bit harder than you hope. One way might be to set up a filtered element collector for the view of interest and then add an additional geometrical location filter to determine the cut elements within the view scope box cutting the view plane. Check out these two articles:

Upvotes: 1

Related Questions