Hi,
probably is too simple, but I can’t find a solution unitl now.
I need a list of all categories inside of revit, basically this list:
How can I get it?!
Thank you everyone
Hi,
probably is too simple, but I can’t find a solution unitl now.
I need a list of all categories inside of revit, basically this list:
Thank you everyone
The list will vary by release, and contains a lot of stuff which isn’t really suitable for human consumption so to speak. As such we need more context on the ask.
Do you want the categories, or the names? If names, what language do you want them in?
Actually i found something similar, but it is too generic:
Give the following code a try, it should give you a initial bit of info
#Created By Brendan Cassidy
import clr
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
categoryList = doc.Settings.Categories
OUT=[]
for cat in categoryList:
if cat.AllowsBoundParameters and not cat.IsTagCategory and cat.CategoryType == CategoryType.Model:
OUT.append([cat.Name,cat])
OUT.sort()
But why do you need them?
Nothing beyond what you’ve posted above can really be provided without more insight into what you’re after. My guess is you’ll want to get the categories from the document, filter out non-built in categories, and then pull the category type, and perhaps more from there. Since your task is specific you’ll likely need to write this in Python on your own. Towards that end this will help: Making a Category names, BuiltInCategory and category Object dictinary
Hi all!
I’m trying other way:
Get all of category inside the model by the Elements, but, as yo can see, I can’t get a list. I don´t know why nevertheless it seems the information passed on the “category.Type” knot but not on “list.FilterByBoolMask” … I’m a little confuse
Did you try this? List of categories of revit - #4 by Brendan_Cassidy
Or this? Making a Category names, BuiltInCategory and category Object dictinary
If so, what about them didn’t work? Are you trying to return the categories in Dynamo?
Sure! I tried the first one, but I can’t separet two lists of “categories”. I show you below what I mean:
Try the following code and do look at this image
#Created By Brendan Cassidy
import clr
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
categoryList = doc.Settings.Categories
OUT=[]
for cat in categoryList:
if cat.AllowsBoundParameters and not cat.IsTagCategory and cat.CategoryType == CategoryType.Model:
OUT.append([cat.Name,Revit.Elements.Category.ById(cat.Id.IntegerValue)])
OUT.sort()
Wise to use my updated code as it converts the category to a dynamo object for use in out of the box dynamo nodes.
I’m using it! Thank you very much
now, I’m trying to obtein a list of categories used on the model (not just a ageneric list of categories), but with some problems too
Have a relook at my image i posted, this should give you enough info to by pass your error.
EG use whats in my image and use either list out of the code block depending on what you need.
If you want to use the categories to get all elements then you use the list of that(red circled output), but if you want to use the string name then use the other list(Blue circled output).