Get ALL 2D items from a view

I am trying to grab all 2D items in a list of views.

I have this… but it’s going to be a long list?

Is there a better way rather than listing each type by name?

Here’s how I would start to go about it:

  1. Get all elements in the view.
  2. Get the category of each element.
  3. Pull the category type from the category
  4. Check if the type is annotation
  5. Filter out elements accordingly
1 Like

How do I check if it’s an annotation?

You might also be able to just check for an OwnerView. That should cover annotations and just leave certain detail components to check.

3 Likes

hello, elements without volume, maybe a track
Cordially
christian.stan

1 Like

Once you have the category, pull the category type from that. There are five possible values per this enumerator: https://www.revitapidocs.com/2023/eb96f224-a134-50e6-57e8-32bcb13bee7d.htm

Give it a shot and see where you get. :slight_smile:

3 Likes

Well this isn’t working well :frowning:

Do you have anything listed as an annotation from the category type node?

Nope

@christian.stan ,

i made one time boundingBoxes and all 2D Elements had a hight by 0.000…

KR

Andreas

1 Like

This is the best approach in my experience, very quick query to make.

I use this exact property in this example code here for pyRevit (mostly works the same way in Dynamo aside from the imports and references to DB not being needed) to filter selection down to 2D elements:

4 Likes

Not had a chance to see if this is what i’m after yet…
Dragged on to 1000000 other things :smiley: