2020 Class
Changes 0
C

Subelement

Description:
An object that represents an element or a subelement within the Autodesk Revit project.
Remarks:

Subelements provide a way for parts of an element to behave as though they were real elements without incurring the overhead of adding more full elements to the model.

Many Revit features (for example parameters, schedules, and tags) were designed to operate on Elements. As a result, the Revit code needs to represent objects as Elements for them to participate in those features. This can lead to scalability problems, because every Element adds overhead and adding many Elements may decrease the performance of the model. An alternative is to use Subelements. An element can expose a set of "Subelements" that it contains, specifying characteristics like their category and parameters, and certain Revit capabilities will treat those Subelements the same as ordinary Elements. For example, a Subelement may contribute geometry to the main element and may be able to be selected independently of its parent Element. It will possibly have its own (settable) type as well as an assigned category which can be different from its parent Element.

In the API, the new Subelement class is used to refer to either an Element or a specific subelement of a given Element. It is typically directly related to a Reference to either the Element or the specific subelement. Note that creation of new Subelements for a given element is not done generically. Instead, the given Element may provide the ability to modify it's definition, resulting in the creation of new Subelements.

Examples of Elements which may have Subelements in practice include:

To get access to a particular Subelement, you may use any of the following:

Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.Subelement
public class Subelement : IDisposable
Name Return Type Description
M CanHaveTypeAssigned() bool Identifies if the subelement can have a type assigned.
M ChangeTypeId(ElementId) None Changes the type of the subelement.
M Create(Document, Reference) Subelement Creates an object representing element or subelement.
M Dispose() None Releases all resources used by the
M GetAllParameters() IList<ElementId> Returns all parameters of this subelement.
M GetBoundingBox(View) The bounding box. Retrieves a box that circumscribes all geometry of the subelement.
M GetGeometryObject(View) GeometryObject Retrieve one geometric primitive representing given subelement.
M GetParameterValue(ElementId) Parameter value. Obtains the current parameter value of this subelement given a parameter id.
M GetReference() Reference Obtains the reference to this subelement.
M GetValidTypes() ISet<ElementId> Obtains a set of types that are valid for this subelement.
M HasParameter(ElementId) bool Checks if this subelement have given parameter.
M IsParameterModifiable(ElementId) bool Checks if given parameter of this subelement is modifiable.
M IsValidSubelementReference(Document, Reference) bool Checks if given Reference identifies either a valid element or subelement.
M IsValidType(ElementId) bool Checks if given type is valid for this subelement.
M SetParameterValue(ElementId, ParameterValue) None Sets a new parameter value of this subelement given a parameter id.
Name Return Type Description
P Category Category Retrieves a Category object that represents the category or sub category of the subelement.
P Document Document The document in which the subelement resides.
P Element Element The element in which the subelement resides.
P IsValidObject bool Specifies whether the .NET object represents a valid Revit entity.
P TypeId ElementId The identifier of this subelement's type.
P UniqueId string A stable unique identifier for this subelement within the document.