The Categories object is a map that contains all the top-level Category objects within the Document.
Namespace:
Autodesk.Revit.DB
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Syntax
C# |
---|
|
Visual Basic |
---|
|
Visual C++ |
---|
|
Remarks
Use this object to retrieve categories by name or by BuiltInCategory id.
Examples
Copy
C#
// Get settings of current document
Settings documentSettings = document.Settings;
// Get all categories of current document
Categories groups = documentSettings.Categories;
// Show the number of all the categories to the user
String prompt = "Number of all categories in current Revit document:" + groups.Size;
// get Floor category according to OST_Floors and show its name
Category floorCategory = groups.get_Item(BuiltInCategory.OST_Floors);
prompt += floorCategory.Name;
// Give the user some information
TaskDialog.Show("Revit",prompt);
Copy
VB.NET
' Get settings of current document
Dim documentSettings As Settings = document.Settings
' Get all categories of current document
Dim groups As Categories = documentSettings.Categories
' Show the number of all the categories to the user
Dim prompt As [String] = "Number of all categories in current Revit document:" + groups.Size
' get Floor category according to OST_Floors and show its name
Dim floorCategory As Category = groups.Item(BuiltInCategory.OST_Floors)
prompt += floorCategory.Name
' Give the user some information
TaskDialog.Show("Revit", prompt)
Inheritance Hierarchy
System
Object
Autodesk.Revit.DB APIObject
Autodesk.Revit.DB CategoryNameMap
Autodesk.Revit.DB Categories
Autodesk.Revit.DB APIObject
Autodesk.Revit.DB CategoryNameMap
Autodesk.Revit.DB Categories