public class Categories : CategoryNameMap
The Categories type exposes the following members.
| Name | Description | |
|---|---|---|
| IsEmpty | Whether or not the list of top-level categories is empty. (Overrides CategoryNameMap.IsEmpty) | |
| IsReadOnly | Identifies if the object is read-only or modifiable. (Inherited from APIObject) | |
| Item[BuiltInCategory] | Retrieves a category object corresponding to a BuiltInCategory id. | |
| Item[String] | Gets a category which has the specified name from this list of top-level categories. (Overrides CategoryNameMap.Item[String]) | |
| Size | The total number of top-level categories in the document. (Overrides CategoryNameMap.Size) |
| Name | Description | |
|---|---|---|
| Clear | Removes every category from the map, rendering it empty. (Inherited from CategoryNameMap) | |
| Contains | Identifies if a category which has the specified name is in the list of top-level categories. (Overrides CategoryNameMap.Contains(String)) | |
| Dispose | Causes the object to release immediately any resources it may be utilizing. (Inherited from APIObject) | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| Erase | Removes a category with the specified name from the map. (Inherited from CategoryNameMap) | |
| ForwardIterator | Retrieves a forward moving iterator to the map. (Overrides CategoryNameMap.ForwardIterator()) | |
| GetEnumerator | Retrieves a forward moving iterator to the map. (Overrides CategoryNameMap.GetEnumerator()) | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| Insert | Inserts the specified category with the specified name into the map. (Overrides CategoryNameMap.Insert(String, Category)) | |
| NewSubcategory | Add a new subcategory into the Autodesk Revit document. | |
| ReverseIterator | Retrieves a backward moving iterator to the map. (Overrides CategoryNameMap.ReverseIterator()) | |
| ToString | Returns a string that represents the current object. (Inherited from Object) |
// 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);
' 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)