Get elements placed in the project

Get elements placed in the project

Anonymous
Not applicable
837 Views
4 Replies
Message 1 of 5

Get elements placed in the project

Anonymous
Not applicable

I am looking to gather all model elements that have been placed in a project. In working through this, I used a FilteredElementCollector to filter all walls, and then delete them.  This resulted with *ALL* walls being deleted, even the unplaced wall families in the Project Browser.  I then checked to see is the wall was on a level.  This worked for walls, and some other element types, such as floors and ceilings, but a lot of other types are showing that they aren't on a level. So this method won't work.  Is there a sure fire method to filter to placed elements in the Revit file?  Am I overlooking something. I tried searching through the API.chm, but unfortunately couldn't find what I am after.

 

Thanks

0 Likes
838 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
It is not clear to me what you are trying to achieve. Do you want to delete all elements on a certain level ?
0 Likes
Message 3 of 5

jeremytammik
Autodesk
Autodesk

Dear Michael,

 

I was not aware of any possibility to have 'unplaced' elements in the project, except for rooms.

 

One idea that comes to mind: I would assume that an unplaced element of any kind cannot have any geometry, because if it did, it would also have to be located somewhere.

 

Whatever your use case, I would assume that the various discussions by The Building Coder on filtering for all elements should come in handy for you:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.9

 

You might also want to look at The Building Coder samples, especially the numerous filtered element collector samples in the CmdCollectorPerformance.cs module:

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/C...

 

If you have a valid use case that is not listed there, I would be interested to add it.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 4 of 5

Anonymous
Not applicable

I am working on a utility to help me publish firm templates.  There are multiple people that are modifying the templates, and I would like to standardize the creation.  One of the steps I am taking is to ensure that there is no placed geometry; i.e. no wall, no components.  I am looking to keep some basic grid elements as well as some default elevations.

 

I started by first filtering for all walls, and deleting those.  But, after I ran the command, I was left with just 2 wall types to chose from in the wall tool. It had deleted all the standard wall types in the project, not just those that were placed to be part of the model.

 

I will take a look at the filtering examples you have suggested Jeremy.  Hopefully there are some combinations there that will work.

0 Likes
Message 5 of 5

jeremytammik
Autodesk
Autodesk

Dear Michael,

 

Thank you for your update.

 

It leaves me a little worried.

 

Are you sure you know what you are doing?

 

Do you want to delete instances, or types?

 

I still do not believe that anything such as a 'unplaced' wall instance exists.

 

And from your description, it sounds as if you are deleting wall types, not instances.

 

Danger!

 

Please understand Revit well from an end user point of view before even thinking about starting to drive it programmatically.

 

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes