The Autodesk.Revit.DB.ServiceType class represents a type of building service that can be used within Revit. This includes various types of mechanical, electrical, and plumbing (MEP) systems such as HVAC, lighting fixtures, and piping.
Id: Gets the unique identifier of the service type.Name: Gets the name of the service type.Description: Gets a description of the service type.Equals(object obj): Determines whether the specified object is equal to the current object.GetHashCode(): Serves as the default hash function.ToString(): Returns a string representation of the service type.ServiceType objects are used to specify the type of service when creating or modifying MEP elements within a Revit project. These objects can be obtained from the Document object or the Element class.
// Get a list of all service types in the current project
FilteredElementCollector collector = new FilteredElementCollector(doc);
List<ServiceType> serviceTypes = collector.OfClass(typeof(ServiceType)).Cast<ServiceType>().ToList();
// Print the name and ID of each service type
foreach (ServiceType serviceType in serviceTypes)
{
Console.WriteLine("Name: " + serviceType.Name);
Console.WriteLine("ID: " + serviceType.Id.IntegerValue);
}
Autodesk.Revit.DB.MechanicalSystemTypeAutodesk.Revit.DB.ElectricalSystemTypeAutodesk.Revit.DB.PlumbingSystemType