Element Types in Python

Hi,

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.

Thanks!

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
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
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):
    			DBtypes.append(spce)
    			dictDBtypes[spce.Name] = spce
    	break

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

Never come to this by myself but it works!

Thanks!

1 Like