List all view templates in available in document

Hi,

Trying to get a list of all view templates available in a document to use in a UI.dropdown data input. Any help? i’m not sure how to extract the list from the View Templates drop down node.

hi @vanman,

Try this,

1 Like

Hi you can try this:


2018-05-24_12-37-04

3 Likes

Or one more option.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

views = UnwrapElement(IN[0])
template_list = []
not_template_list=[]

for view in views:
	try:
		if view.IsTemplate:
			template_list.append(view)
		else:
			not_template_list.append(view)
	except:
		not_template_list.append(view)

OUT = template_list,not_template_list
1 Like

Thanks Ewan_Opie. Tried using your script as values to apply templates and monica.greco as keys but one has 3Ds in it and one dosnt. Not sure how i would use Ewans and just extract template names for tidier keys

Try this, using @Ewan_Opie script

Unfortunately you can’t get 3D view templates with this method, but I guess you don’t need them anyway …

3 Likes

awesome thank you

Hi where can i get the “Element.Name+” node?

image

2 Likes

I think is easier to get the view template list of a model.
When you get all elements of a view category, include a list of views and view template elements.
After that you can fliter that list by a parameter exclusive of a view element (Sheet Number or Detail Number for example). View templates has no Sheet Number parameter.
In the example below the model has three views (called Plan View, Ceil View and Elev View) and three view templates (called View Templ1 , 2 and 3).

Sorry my bad english

3 Likes

So what is it with ThreeD view templates? Just a bungled Revit API?
image