Purge/Delete unused elements

This is superb but how to make until it becomes 0 (Zero) purged items.

Thanks in advance.

Hi @shrawanram and @Alban_de_Chasteigner ,
I am also having this doubt, have any of you been able to run the script until the purged items are 0?


Hi Clara,

In Dynamo, you can reproduce the Revit function Purge unused.
But it will be exactly like in Revit, you have to repeat the command 3 times.

Hi Alban, I used the python script and got that to execute the revit command “Purge Unused” , but it will only do it once no matter how many times it appears in the Dynamo graph. How can I get it to repeat the command 3 times ?

Hi Philipp,

It’s not possible to repeat the postable command.

See also this post :

There are other ways than using postable commands… try the purge node in the Orchid package


Can you share with us the code behind the node Document.Purge? I am curious which method is used to achieve that.
Thank you!

He leveraged a portable command last I knew. Best to ask in the github for the orchid project as he isn’t active here anymore.

1 Like

@oliver.green translated this code snippet from VB to IronPython :

The iron python script :


Thank you very much!

Ummm … guys … I can’t find anyone who’s posted this here yet but:
Model Cleanup - Deleting Views
About Aug 2017, @Andy_Grout posted regarding a model cleanup complete with choices running in the Dynamo Player.
I’ve also created & use this Purge All graph: Purge%20All%20graph
This graph uses the Orchid package 202.4.2 or newer. Developed in Dynamo 2.0.

[edit] Missed listing @erfajo 's post, it is another example of purging. His post is for purging excess files from a directory though (ie: RevitFile.0001.rfa). I’m still learning.

Hope this helps.

There is a Youtube Video to purge unused

Dynamo - Purge Unused

Hey guys I found this on twitter by someone named Bird Tools. I don’t know much about this command, but I tried it in Dynamo and it works but it takes a while to process.