ChangeTypeId Method (Document, ICollection(ElementId), ElementId)

Changes the type of all elements in the given set.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: (
Since: 2011


public static IDictionary<ElementId, ElementId> ChangeTypeId(
	Document document,
	ICollection<ElementId> elementIds,
	ElementId typeId
Visual Basic
Public Shared Function ChangeTypeId ( _
	document As Document, _
	elementIds As ICollection(Of ElementId), _
	typeId As ElementId _
) As IDictionary(Of ElementId, ElementId)
Visual C++
static IDictionary<ElementId^, ElementId^>^ ChangeTypeId(
	Document^ document, 
	ICollection<ElementId^>^ elementIds, 
	ElementId^ typeId


Type: Autodesk.Revit.DB Document
The document.
Type: System.Collections.Generic ICollection ElementId
A collection of element IDs.
Type: Autodesk.Revit.DB ElementId
Identifier of the type to assign to this element.

Return Value

The map of original element IDs to the new element IDs if some elements were replaced by new elements (the map is empty if no elements were replaced)


In some 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. Then return map would have (original element id, new element id) pair(s). Note: this function needs an open transaction. Note: this function calls regeneration.


Exception Condition
Autodesk.Revit.Exceptions ArgumentException At least one of the elements in elementIds does not exist in the document -or- Not all elements elementIds can have a type assigned. -or- The type typeId is not valid for at least one of the elements in elementIds.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions InvalidOperationException One or more elements in elementIds is a member of a loaded family. -or- One or more elements in elementIds is a member of a group type that is not being edited.

See Also