How get OST (Built-In Name) of element

python

#1

How get OST category name of element?

for examle we are have selected pipe in Revit to IN[0]

ostcategory=GetOST( IN[0] ) ??

And we get this:
OUT=ostcategory

OST_PipeCurves


#2

Revit Category Guide.xlsx (368.6 KB)

I use this spreadsheet which lists the OST Revit Categories.


#3

@Claus thanks, but im want to get Built-In Name (AsString) of element in Dynamo )


#4

Hi @til.shviger

Are you looking for this?


#5

@Kulkul
YES!
can you show what is inside the script?


#6

Sure!

import clr, System
clr.AddReference("RevitNodes")
import Revit
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
 
catname = IN[0]
bic = System.Enum.GetValues(BuiltInCategory) 
cats, bics = [], []
for i in bic:
    try:
        cat = Revit.Elements.Category.ById(ElementId(i).IntegerValue)
        cats.append(cat)
        bics.append(i)
    except:
        pass
 
for i, b in zip(cats, bics):
    if catname == str(i): 
        ost = b 
 
OUT = ost

#7

@Kulkul

everything works perfect! :ok_hand:

Thank you!


#8

@til.shviger You’re welcome!

Merry Christmas :christmas_tree: and happy holidays :slight_smile: . Cheers!


#9

Merry Christmas ! :sparkler: I Wish you happiness and success at work in the New Year :hugs:


#10

I tried this just now and got the following error:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line 25, in <module>
NameError: name 'ost' is not defined

so basically the variable to get the resulting category is not working for me. The end game for me is to get a handle on Revit Links and extract information from linked RVT documents. Found the category:

Autodesk.Revit.DB.BuiltInCategory.OST_RvtLinks

but not sure how to access the elements with this built-in category.
Thoughts?