DeleteSubelement Method


Removes a subelement from the element.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 22.0.0.0 (22.1.0.0)
Since: 2018

Syntax

C#
public bool DeleteSubelement(
	Subelement subelem
)
Visual Basic
Public Function DeleteSubelement ( _
	subelem As Subelement _
) As Boolean
Visual C++
public:
bool DeleteSubelement(
	Subelement^ subelem
)

Parameters

subelem
Type: Autodesk.Revit.DB Subelement
The subelement to delete.

Return Value

True if entire element was deleted, false otherwise.

Remarks

Depending on implementation for given element as the result, the element can be deleted - especially if after subelement deletion there are no subelements left.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException The subelement subelem does not exist in the element. -or- Subelement subelem cannot be deleted.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions ModificationForbiddenException This Element is an internal element, such as a component of a loaded family or a group type. -or- The document containing this Element is in Group Edit Mode, Sketch Edit Mode, or Paste Mode, and the element is not a member of the group, sketch, or clipboard. -or- This Element is a member of a group or sketch, and the document is not currently editing the group or sketch.

See Also