Delete Unused(or selected) View Templates and Filters

Coming from this thread

Just wondering for the current RIR, if there’s a way to delete unused(or selected) view templates and filters?

Do you have pyrevit?

image

If not you would query views and get all the templates/filters and do a set difference to figure out which ones to delete.

Do you have pyrevit?

No but I’ll look into it!

If not you would query views and get all the templates/filters and do a set difference to figure out which ones to delete.

Yes I certainly can do that. Sometimes we encounter lots of unused in a single rvt so I was just thinking if the “wipe” action can be done through RIR, or “use pattern to wipe the desire” which is even better.
By the way for filter I couldn’t find it under View Identity.

So this is so far where I am.

Query Views only gives me the view templates that are in used.
Try to query all the view templates first.

All the View Templates are found in the Query Views, just add a Boolean Toggle to the Is Template Option.

Ahh at first I thought that boolean is just a reverse function… thanks a lot!!

I just arrived at work and it perfectly for the file, thanks again Japhy.
So for the filter(parameter/selection) could it be done in the same way?

Hi @ctu6,

You can use ‘Purge Element’ like this.
It should work as well with Materials, Types or other elements.

This component tries to delete an element, if no other element is modified while deleting this element, means no other element is referencing it. So is safe to purge-delete.

In my case I have only one view template in use thats why I have just one False on the ‘Succeeded’ output.

‘Deleted’ and ‘Modified’ tell you what other elements are deleted or modified because of the Purge operation.

While you are playing with this component may be nice to right click and put the component in Simulation mode, that way the component does nothing effective on the document, and allow you to explore what would happen if you connect this or that. Also useful to check if an element has other references.