Categories
Description:
The Categories object is a map that contains all the top-level Category objects within the Document.
The Categories object is a map that contains all the top-level Category objects within the Document.
Remarks:
Use this object to retrieve categories by name or by BuiltInCategory id.
Use this object to retrieve categories by name or by BuiltInCategory id.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.CategoryNameMap
Autodesk.Revit.DB.Categories
System.Object
Autodesk.Revit.DB.APIObject
Autodesk.Revit.DB.CategoryNameMap
Autodesk.Revit.DB.Categories
public class Categories : CategoryNameMap
// 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);
| Name | Return Type | Description | Inherited From |
|---|---|---|---|
| CategoryNameMap() | None | Initializes a new instance of the class | CategoryNameMap |
| Name | Return Type | Description | Inherited From |
|---|---|---|---|
| Contains(String) | bool | Identifies if a category which has the specified name is in the list of top-level categories. | |
| ForwardIterator() | CategoryNameMapIterator | Retrieves a forward moving iterator to the map. | |
| GetEnumerator() | IEnumerator | Retrieves a forward moving iterator to the map. | |
| Insert(String, Category) | bool | Inserts the specified category with the specified name into the map. | |
| NewSubcategory(Category, String) | Category | Add a new subcategory into the Autodesk Revit document. | |
| ReverseIterator() | CategoryNameMapIterator | Retrieves a backward moving iterator to the map. | |
| Dispose() | None | Causes the object to release immediately any resources it may be utilizing. | APIObject |
| Clear() | None | Removes every category from the map, rendering it empty. | CategoryNameMap |
| Contains(String) | bool | Tests for the existence of a category with that name within the map. | CategoryNameMap |
| Erase(String) | int | Removes a category with the specified name from the map. | CategoryNameMap |
| ForwardIterator() | CategoryNameMapIterator | Retrieve a forward moving iterator to the map. | CategoryNameMap |
| GetEnumerator() | IEnumerator | Retrieve a forward moving iterator to the map. | CategoryNameMap |
| Insert(String, Category) | bool | Insert the specified category with the specified name into the map. | CategoryNameMap |
| ReverseIterator() | CategoryNameMapIterator | Retrieve a backward moving iterator to the map. | CategoryNameMap |
| Name | Return Type | Description | Inherited From |
|---|---|---|---|
| IsEmpty | bool | Whether or not the list of top-level categories is empty. | |
| Item | Category | Retrieves a category object corresponding to a BuiltInCategory id. | |
| Item | Category | Gets a category which has the specified name from this list of top-level categories. | |
| Size | int | The total number of top-level categories in the document. | |
| IsReadOnly | bool | Identifies if the object is read-only or modifiable. | APIObject |
| IsEmpty | bool | Test to see if the map is empty. | CategoryNameMap |
| Item | Category | Gets or sets a category at a specified name within the map. | CategoryNameMap |
| Size | int | Returns the number of categories that are in the map. | CategoryNameMap |