Python - Cant get View Family Types Name in one script



I’m writing some Python code in Dynamo to set up elevations.

As part of this I need to find a certain ViewFamilyTypes - to do this I need to return the ViewFamilyTypes Name, which I can do with the following two pieces of code:

(Note that the code picks out the fifth ViewFamilyTypes - which is the one I need, I will eventually write some code which evaluates the list).

And then:

This returns:

Which is what I want.

But I want don’t want two pieces of code, I want to add them together, so I did this:

But this generates the error:

Am I missing something, I cant work out why two pieces of code works, whereas one doesn’t.

I would appreciate some advise.


Hi @Kevin_Bell

If you wrap your element you’ll be able to access it’s name :

Make sure to import all the required extensions:

import clr
from Autodesk.Revit.DB import*
from RevitServices.Persistence import DocumentManager
import Revit

doc = DocumentManager.Instance.CurrentDBDocument
a = []

viewfamilies = FilteredElementCollector(doc).OfClass(ViewFamilyType).ToElements()

pickone = viewfamilies[5].ToDSType(True)

name = pickone.Name

OUT = name

I see, I thought wrapping was either the WrapElements or UnWrapElements command - ToDSType is new to me.

Where can I find information about the Revit.Elements namespace? Looking through the Revit 2015 API.chm help file I cannot seem to find anything in there. Guess its a Dynamo thing then…


Yes It’s a Dynamo thing. You can read about it here: (and maybe here


Thank you @Mostafa_El_Ayoubi this is helpful. But I was wondering if want to get the name of a ViewFamily in a python script but outside dynamo will this work?
Since I far as I know that unwrapping Elements is only a dynamo thing right?