PDA

View Full Version : cathegory of family



bernd.eichner
2007-09-23, 11:38 PM
hi forum
with " revit.Application.ActiveDocument.LoadFamilySymbol(fileName, symName) "

i load the selected family. how can i get the name of cathegory of it?
bernd

mmason.65315
2007-09-24, 12:57 PM
I believe that the family object doesn't hold a category - but the Symbols (Types) inside it DO have a category.

Best Regards,
Matt

bernd.eichner
2007-09-24, 02:56 PM
well, i think, this is what i meant. an how can i get this name?
bernd

Elizabeth Shulok
2007-09-24, 08:30 PM
revit.Application.ActiveDocument.LoadFamilySymbol(fileName, symName) will give you the FamilySymbol (symName). From there, you can call:

string strCatName = symName.Category.Name;

(First make sure symName.Category != null)

This gives you the name of the category as a string.

Hope this helps,
Elizabeth

bernd.eichner
2007-09-24, 09:53 PM
thanks, elizabeth,
but symname is declared as a string and the error message tell me the category is not a member of 'string'
bernd

Elizabeth Shulok
2007-09-24, 11:25 PM
Oops, sorry, I didn't look closely enough at your code. Use the other LoadFamilySymbol which has a 3rd parameter that returns the FamilySymbol:

[Visual Basic]
Overloads Public Function LoadFamilySymbol( _
ByVal filename As String, _
ByVal name As String, _
ByRef symbol As FamilySymbol _
) As Boolean

Then you can use FamilySymbol.Category.Name to get the name of the Category.

Regards,
Elizabeth

bernd.eichner
2007-09-25, 02:25 AM
many thanks
bernd