Oh my, I now realise how long it’s been since I last posted here. This feels good!
Hello everyone!
I am trying to get the DefaultTemplateId property of a ViewFamilyType
My problem though is that I cannot get a ViewFamilyType object out of Dynamo as it sees everything as an ElementType (which is it’s parent object ViewFamilyType Class)


I tried in python to change the class with myElementType.__class__ = ViewFamilyType
but that’s just for classes defined by you (fair enough).
At this point it’s really doing my head in and I don’t understand how could I get there.
I’m using Revit 2021
Anyone came across this issue?
Hi @ATassera
If you’re using Python just unwrap them and use the ViewFamilyType.DefaultTemplateId
property:
import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
viewFamilyTypes = UnwrapElement(IN[0])
defaultTemplateIds = []
for viewFamilyType in viewFamilyTypes:
defaultTemplateId = viewFamilyType.DefaultTemplateId
defaultTemplateIds.append(defaultTemplateId)
OUT = defaultTemplateIds
3 Likes
Thanks @Thomas_Mahon I know I can always count on you! 
It’s weird because I was unwrapping the input, but still it wasn’t working…unfortunately I was so frustrated I deleted my python node so I can’t check what else I was doing wrong 
Anyway that fixes it. Thanks again!
EDIT: Actually now I remember what was going wrong: even after unwrapping, my python node was complaining that an ElementType didn’t have a DefaultTemplateId property. But it’s working now for some reason. Oh well, it’s working, that’s all that matters
2 Likes