I got a strange phenomenon in Revit 2022.1 . “View Template” appears twice in the elements’ parameters. The actual value is set in the 1st or 2nd one – the other being null. There is no redundant project or shared parameter that I see in the RVT.
or
Anyway, since the other get element parameter (even brute force) nodes are not consistently finding the parameter values, this is a workaround:
In this case, you could check the ElementId instead of the name. For whatever reason Revit only tracks the readable name in one of the parameters, but correctly tracks the element in both.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
views = UnwrapElement(IN[0])
values = []
for view in views:
param = view.LookupParameter("View Template")
value = param.AsElementId()
el = doc.GetElement(value)
if el != None:
name = el.Name
else:
name = "None"
values.append(name)
OUT = values
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
views = UnwrapElement(IN[0])
values = []
doc = DocumentManager.Instance.CurrentDBDocument
for view in views:
param = view.LookupParameter("View Template")
value = param.AsElementId()
el = doc.GetElement(value)
if el != None:
name = el.Name
else:
name = "<None>"
values.append(name)
OUT = values