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
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
Revit Category Guide.xlsx (368.6 KB)
I use this spreadsheet which lists the OST Revit Categories.
@Claus thanks, but im want to get Built-In Name (AsString) of element in Dynamo )
@Kulkul
YES!
can you show what is inside the script?
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
@til.shviger You’re welcome!
Merry Christmas and happy holidays . Cheers!
Merry Christmas ! I Wish you happiness and success at work in the New Year
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?
If you are like me and must know the details to remember something here is a nugget for you.
Built-in Category OST Prefix - What does it stand for
Almost all the built-in category enum values come equipped with an “OST_” prefix.
OST_ it is short for “O” bject “ST” yle.
Credit: Jeremy Tammik + arnostlobel
Hi @Kulkul,
I’m trying to understand your script line by line (novice), and can’t work out the ById() part. Where does it come from? I can’t seem to find it in the API documentation, or in Dynamo (although most of that path is there).
I can make it work, but I don’t understand it at all! Any help most appreciated!
Please convert Catname ToString
if catname.ToString() == i:
# by Alexander Berg | 2020-03-07 | Automated Design Solutions
import clr, System
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
OUT = [i for i in System.Enum.GetValues(BuiltInCategory) if str(i) == "OST_"+IN[0]]
This guide is so helpful, thanks for sharing
Does OST refers to object style type?
Hi,
Do you know what’s the correct Python syntax for the following C# line?
I’m having trouble matching the Id value to the string OST_Rooms.
if ( (BuiltInCategory)element.Category.Id.IntegerValue == BuiltInCategory.OST_Rooms)
{
...
}
Thanks
hello you can try this
if element.Category.Id.IntegerValue.ToString() == BuiltInCategory.OST_Rooms.value__.ToString() :
OR better
if element.Category.Id == ElementId(BuiltInCategory.OST_Rooms) :
Perfect, thanks!
Can you explain a bit where the .value__
parameter comes from?