2027 Class
Changes 0
C

Categories

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