Please explain accessing FamilySymbol Name Parameter

Please explain accessing FamilySymbol Name Parameter

Anonymous
Not applicable
3,975 Views
12 Replies
Message 1 of 13

Please explain accessing FamilySymbol Name Parameter

Anonymous
Not applicable

Can someone please explain why accessing a family Symbol's name parameter is so unusual.  

 

FamSym.Name

This looks like it should work when I look at the help file, and I've seen examples of this being used online.  However, if I use it in my Python scripts I get an error saying that property doesn't exist.  To get around this I have to use:

 

FamSym.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM)

 

This obviously works, but it's been a hang up while I'm working, and I'm interested to know why I have to handle this differently than other object names.

 

Cheers

Eric

0 Likes
3,976 Views
12 Replies
Replies (12)
Message 2 of 13

rosalesduquej
Alumni
Alumni

Hi Eric,

 

I'm no expert with the RevitPythonShell, but like you said I have seen other examples in the past before using similar behaivor to obtain the Family Symbol name. Have you tried FamSym.Family.Name ? 

 

Here are 2 links where I saw this. 

 

http://wiki.theprovingground.org/revit-api-py-family 

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
Message 3 of 13

Anonymous
Not applicable

Hi Jaime,

 

Thanks for responding.  Unfortunately FamSym.Family.Name will return the name of the family.  I am looking for the name of Type within that family, which in Revit-API-land is called the Symbol.  

 

If you open up the RPS you can see the difference between FamSym.Family.Name and FamSym.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM)

 

Any other thoughts?

Message 4 of 13

Anonymous
Not applicable

I must say to thanks you, i was crazy when i want to get Name of familytype, but can not i don't know why, and i see your topic. Thanks you moa moa moa

0 Likes
Message 5 of 13

jgemperline
Explorer
Explorer

Its been some time now. But I ran across the same problem. Wondering if there have been any discoveries in the past couple years on this topic. 

0 Likes
Message 6 of 13

studio-a-int
Advocate
Advocate

In Python you can simply collect all elements of that Category (below example is for Pipe Fitting), then iterate through  with a simple list comprehension, and you can get the Type Names:

 

PIPE_FITTINGS = FilteredElementCollector(doc).OfClass(FamilySymbol).OfCategory(BuiltInCategory.OST_PipeFitting).ToElements()

PIPE_FITTINGS_TYPES_NAMES = [i.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString() for i in PIPE_FITTINGS]

Message 7 of 13

jgemperline
Explorer
Explorer

To get the Name of the symbol I was expecting to use something like:

familysymbol.Name

The proposed solution feels more like a workaround. It works but when I walk through the API dock it seems like Name should work too as one of its properties. I'm new to this stuff so I could be way off.

What am I missing here? 

Message 8 of 13

RPTHOMAS108
Mentor
Mentor

If you leave it as an Element without casting to FamilySymbol then can you still read the .Name property? I think this is true.

 

For some odd unknown reason .Name is changed at ElementType level to make it WriteOnly.

 

WriteOnly properties are a mystery to me as far as the RevitAPI is concerned. I'm allowed to name something but I can't know it's existing name???

0 Likes
Message 9 of 13

Anonymous
Not applicable

This has been my go-to solution as well. Being unable to access FamilySymbol.Name seems like a pretty strange omission! 

0 Likes
Message 10 of 13

Anonymous
Not applicable

Agreed - there still seems to be something buggy about FamilySymbol.Name.

Access the value via the BuiltInParameter for more reliability!

0 Likes
Message 11 of 13

MarryTookMyCoffe
Collaborator
Collaborator
symbol.Name

it is so weird that this doesn't work for you(in C# it work). Family Symbol have changed Set, but you should still be capable using a get from Element class. Shouldn't get be inheritance from Element class? why this work different in C#?

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 12 of 13

RPTHOMAS108
Mentor
Mentor

It's overridden as WriteOnly at ElementType inheritance level. There is no real issue in some respects, you just get the name before casting to FamilySymbol or some other ElementType. Can also cast an ElementType to an Element to get the name value.

0 Likes
Message 13 of 13

jkirk-OMM
Enthusiast
Enthusiast

Thank you!!! Finally. This solution worked for what I needed. I just wanted the available family type names in a list.

0 Likes