Getting the category of an element using Element.GetParameterValueByName

Hi all

Along with a variety of other parameters, I’m trying to grab the Revit Category of my elements into a list for export to Excel. (I’m grabbing multiple categories at the same time)

I think I have confirmed that “Category” is the name of the parameter I want (see image 1) but when I try to grab it using Element.GetParameterValueByName I get a Opereation Failed, with “Element.GetParameterValueByName operation failed. Could not obtain element from the current document! The id may not be valid.”. (image 2)

Any ideas ? Thank you

category

 

 

 

 

Hi Robert,

I think you need to change “Lacing” to longest. Right click “Element.GetParameter” change Lacing to longest.

Thanks Kulkul

I found a solution in using Element.Category which is part of the Rhythm package. It gathers the element list, finds the categories for each and spits out the result as a string. Exactly what I needed.