Get view template of 3D view

Hi Guys,

have any of you goto any ideas how to get the view template as element of an 3D view? ive tryied everything but no luck :frowning: ive also tryied the revitlookup table.

hope to hear from you guys

Hi @wihibyusuf,

This is a known limitation of Dynamo.

1 Like

Use the property accessor:

viewTemplateId = view.ViewTemplateId 

templateElement = doc.GetElement(viewTemplateId)

Hi @wihibyusuf

I don’t think it is possible to get a Dynamo 3D view of the ViewTemplate.

It is possible to get the API object for the viewTemplate. Dynamo constantly tries to wrap the API object to a Dynamo object (which results in a Null for 3D view templates)

This also returns a null for me, Dynamo tries to wrap the API 3D View into a Dynamo 3D view

yes thank you @Joelmick ive noticed the same thing. still im getting nulls :frowning:

mee too also

Spring nodes implemented a node to collect all of them.

image

within his node he actually wrapped the 3d view templates himself:

import clr

clr.AddReference('RevitAPI')
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

ueWrapper = None
wrappers = clr.GetClrType(Revit.Elements.ElementWrapper).GetMethods()
for w in wrappers:
	if w.ToString().startswith("Revit.Elements.UnknownElement"):
		ueWrapper = w
		break

fec = DB.FilteredElementCollector(doc).OfClass(DB.View3D)
OUT = []
for i in fec:
	if i.IsTemplate:
		OUT.append(ueWrapper.Invoke(None, (i, True) ))
8 Likes

Hi @john_pierson do you know if there is another similar node that works to get the templates associate at the 3D views inside the linked models in a project?
Thank you
Cheers

You can use the View ByName or the SelectByCateOrType nodes for 3D view templates.

Hi @Alban_de_Chasteigner , thank you very much for your answer, but I would like to get the Template Name from my 3D view from the linked model like below:


Thank you for your efforts
Cheers

GetParameterValueByName works only in the current document and not for the linked documents.

Thank you @Alban_de_Chasteigner , for your answer, yes you are right, but I have the same result with “View.ViewTemplate” node from Clockwork, is there another note to do this task?


Cheers

Hi @Alban_de_Chasteigner I figured out , it’s something funny, if in a 3D view a template is created from a 3D view I can’t get it, but if the template came (from example) from floor plan view it’s works…
image


any thoughts?
Cheers

It has already been answered in posts 8 and 10.

Hi @Alban_de_Chasteigner excuse me but the object of the post is “Get view template of 3D view”, and I thoughts that is useful also for others that you can Get view template of 3D view, if the Template that is applyed is not generate from a 3D view. I hope that make sense.
Thank you for your time
Have a good day
Cheers

Sorry but that’s not true now.
Dimitar Venkov found a solution, @john_pierson showed it in post 8.
I also integrated this method into a few nodes, see post 10 (crediting Dimitar into the custom nodes)

1 Like

Hi @Alban_de_Chasteigner yes of course you are right, my problems it was to get the name of 3D view template applyed on the 3D view of linked files, I found another workaround with schedule view. Thanks