ChangeTypeId Method


Subelement Change Type Id Method

Changes the type of the subelement.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public void ChangeTypeId(
	ElementId typeId
)

Parameters

typeId ElementId
Identifier of the type to assign to this subelement.
Exceptions
Exception Condition
ArgumentException The type typeId is not valid for this subelement.
ArgumentNullException A non-optional argument was null
InvalidOperationException This Subelement cannot have type assigned.
ModificationForbiddenException This Subelement is an internal element, such as a component of a loaded family or a group type. -or- The document containing this Subelement 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 Subelement is a member of a group or sketch, and the document is not currently editing the group or sketch.
Remarks
In rare cases, applying a change in type will result in a new element being created. The only active examples of this are when:
  • Applying a normal wall type to a curtain panel.
  • Converting such a wall back to a curtain panel.
  • Applying a new type to a railing subelement.
In this situation this subelement object will be redirected to the new element.
See Also
ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →