Pre-Delete Elements: Know What You're About to Delete

revit
python
dynamo

#1

Hi all,

The question: how to know which elements would be deleted if I deleted a certain object in my model?
For instance, if I deleted a wall, can I get a list of its hosted objects which would also get deleted?

I’ve been looking for a Python version of this workflow for some time, so though I’d share.

Credit to @Deyan_Nenov for his macro version (I’ve just more or less transcribed it to Python) and to @Thomas_Mahon for various tips. Original macro can be found here: https://twitter.com/didonenov/status/837293919159390208

The definition can be found here:

Element - Pre-Delete.dyn (8.1 KB)

Hopefully someone else finds it helpful!

Ollie


Remove unused reference planes
#2

Hey @oliver.green, I went ahead and changed the topic to Share since this is a solution and not a question.
Good work though!


#3

Update: The Revit 2019 API now contains a method which will return the ElementIDs of dependent elements.

Posted under section 2.3 of this document:

As such, if you’re in 2019 you’ll be wanting to use this method instead of the Dynamo script posted above.

Thanks

Ollie


#4

They actually added it in Revit 2018.1 update! :sunglasses:

http://www.revitapidocs.com/2018.1/56e875d3-014b-a996-69c3-e6ed9b885f5c.htm