Node > DesignScript > API/Python... Is there a Dictonary that has these translations?

Is there a dictonary f.e. that i can call “all elements by Category” via Design Script or Python or Dynamo direct? Reagarding learning it think it is important.

Are there examples in this way?, particulary to understand API/C# and Python codes!

KR

Andreas

Hi @Draxl_Andreas,

In python, you can do like that :

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
#Import Collections
from System.Collections.Generic import *
import System

cat = IN[0]

bic = System.Enum.ToObject(BuiltInCategory, cat.Id)
catlist=FilteredElementCollector(doc).WhereElementIsNotElementType().OfCategory(bic).ToElements()

OUT = catlist

Bycategory

2 Likes

The previous answer solves your problem, but I would use a slightly different script, specifying a category in the code.
Like this.

as1 = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericModel).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralFoundation).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_EdgeSlab).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralColumns).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_StructuralFraming).WhereElementIsNotElementType().ToElements(), FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Stairs).WhereElementIsNotElementType().ToElements()