Get FamilySymbol's name (Family Type Name)

Hi everyone,

I’m writing a Revit macro using Python trying to collect all Family Type 's names but the returned result seems strange. I did collect successfully the Family Type elements (FamilySymbol) but somehow I can’t manage to get their name. Could anyone advise ? Greatly appreciate. Cheers

allcollector = FilteredElementCollector(self.ActiveUIDocument.Document).OfClass(FamilySymbol)
allelementlist = allcollector.ToElements()
    		
    		
 string1= "... \n"
        for i in allelementlist:
        string1 += i.ToString() + "\n"
 TaskDialog.Show ("FamilySymbol", string1)

ToString() will returns the name of the object (ie FamilySymbol), not the parameter name revit uses.

I know 2 ways to get “Name” of a family symbol:

Element.Name.GetValue(symbol)

and

symbol.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM)

10 Likes

Thank you so much @Gui_Talarico. It works like a charm, both ways.

                allelementlist = []
		symbol = []
		
		allcollector = FilteredElementCollector(self.ActiveUIDocument.Document).OfClass(FamilySymbol)
		allelementlist = allcollector.ToElementIds()
		symbol = allcollector.ToElements()
		
		symbolName = [Element.Name.GetValue(i) for i in symbol]
		
		stringtmp = " SymName: \n"
		for i in symbolName:
			stringtmp += i + "\n"
		TaskDialog.Show("SymName",stringtmp)

why self is not work for me (error - self is not defined)?

self.ActiveUIDocument.Document

May be need to add some library?