Clockwork - View is View Template problem

Hello everyone.

I am trying to get the list of view templates, and when I use the shown script, sometimes it gives the correct output and sometimes the output is all the views. Any other mothod to get the view templates ?

Thanks

6669

I modified the python by @Mostafa_El_Ayoubi in the above post to give a list of all view templates, not just those that are applied to a view

possibly because of the known issue where dynamo can not find 3d view templates I needed to convert the element ids to strings, the strings to numbers, and the numbers back into element ids before removing nulls

collect all view templates.dyn (20.8 KB)

"
# forked from Mostafa_El_Ayoubi
# https://forum.dynamobim.com/t/delete-view-templates-not-in-use/5327
# OUT templates
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

views = FilteredElementCollector(doc).OfClass(View)
appliedtemplates = [v.ViewTemplateId for v in views]
templates = [v.Id for v in views if v.IsTemplate == True]

OUT = templates
";

This is nice but would be nicer in the Share category rather than on a post that is 2 years old with such a specific title :slight_smile:

fair point, I wasn’t sure where to put it… I am now :slight_smile:

1 Like