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)
![](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/2/4/24224be4be8ea6f823e254677de86f081d1a0170.png)
10 Likes
Thank you so much @Gui_Talarico. It works like a charm, both ways.
![](//cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/a/e/ae75e4b50beb2f018bbd696241d51039196b200b.png)
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?