Get the category name of the element Instance and type

Very good days.
I am trying to obtain the name of the category to which my element belongs using PYTHON, I don’t know if it is the same process for type and instance elements.
Thanks for the help.

What available methods/properties do you see when you try commenting out your loop, and set OUT to dir(elementos[0])?

2 Likes

??? :face_exhaling: :face_in_clouds:

It at the CPU today so I can’t type this out myself, but look over the list of results if you remove everything after line 12, and type up OUT = dir(elementos[0]). The result should be a list of strings, which you can then wire into a String.Contains node to find anything you could call on the object that contains ‘categ’. One of those will work for you.

2 Likes

Hi,
Mr. Jacob sows the little stones to structure your knowledge

import sys
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import Element

# Input revit element
Elementos=UnwrapElement(IN[0])

prueba=[e.Category.Name for e in Elementos]

OUT = dir(Elementos[0]),prueba,type(prueba[0])

edit: Take Dynamo Further 🚀 - Dynamo Python Primer
cordially
christian.stan

3 Likes