Maciej Główka
Blog Games Contact

← Return to Blog Index

purgeTemplates.png
Oct. 10, 2020

Purge view templates in Revit

revit api dynamo

So, you cannot purge view templates in ‘out of the box’ Revit. I have just learned recently. Probably I have never needed it before, but recently I did.

I have no idea why this function would be missing, but it is very easy to implement in API. You can use a C# macro manager for that perfectly fine, but somehow it seemed faster for me just to use a python node in Dynamo.

The procedure is simple. First you collect all the views (FilteredElementCollector). Then you loop through them and build a list of view templates that are in use.

Then you pick only views that actually are view templates and one by one you check whether they are present in the aforementioned list. If not, template is deleted.

That’s all. Dyn file and python script below.

purgeTemplates.dyn
← Tag rooms in multiple views Onion nodes – tag on multiple views workflow→