Revit 2021.1 API |
Element..::..ChangeTypeId Method (ElementId) |
Element Class See Also |
Changes the type of the element.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since:
2011
Syntax
C# |
---|
public ElementId ChangeTypeId( ElementId typeId ) |
Visual Basic |
---|
Public Function ChangeTypeId ( _ typeId As ElementId _ ) As ElementId |
Visual C++ |
---|
public: ElementId^ ChangeTypeId( ElementId^ typeId ) |
Parameters
- typeId
- Type: Autodesk.Revit.DB..::..ElementId
Identifier of the type to assign to this element.
Return Value
The new element id if new element is created, or InvalidElementId if the element's type changed without creating a new element.
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, or
converting such a wall back to a curtain panel.
In this situation the new element id is returned.
Also, this element becomes invalid.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..ArgumentException | The type typeId is not valid for this element. |
Autodesk.Revit.Exceptions..::..ArgumentNullException | A non-optional argument was NULL |
Autodesk.Revit.Exceptions..::..InvalidOperationException | This Element cannot have type assigned. |
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. |