Element Types in Python


For a custom code that i’m building. I need the “Element Types” node translated in Python.

Element Types

I tried a lot of FilterElementCollectors and Categorie filters but i can’t get the same result as we can see in this node in Dynamo.

Anybody an idea what’s the right way to filter for this results.


I thinking that Dynamo translated internal software’s geometry to itself type - to working with them in Dynamo’s interface (as Dynamo’s objects) and in some situations you will not getting same results as in Dynamo’s node selection’s result.
That post uninformated… please, add more info about types that you want getting and, of course, software - revit/civil/etc …

Hi @f.vLion and welcome
here an example

import sys
import clr
import System
from Autodesk.DesignScript.Geometry import *

import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

DBtypes = []
dictDBtypes = {}
for a in System.AppDomain.CurrentDomain.GetAssemblies():
    if a.GetName().Name == 'RevitAPI':
    	types = a.GetTypes()
    	for spce in types:
    		if spce.IsSubclassOf(DB.Element):
    			dictDBtypes[spce.Name] = spce

DBtypes = sorted(DBtypes, key = lambda x : str(x.FullName))
OUT = dictDBtypes

Never come to this by myself but it works!


1 Like