ChangeNumber Method

Replaces an existing number with a new one (that does not exist yet).

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


public IList<ElementId> ChangeNumber(
	string partition,
	int fromNumber,
	int toNumber
Visual Basic
Public Function ChangeNumber ( _
	partition As String, _
	fromNumber As Integer, _
	toNumber As Integer _
) As IList(Of ElementId)
Visual C++
IList<ElementId^>^ ChangeNumber(
	String^ partition, 
	int fromNumber, 
	int toNumber


Type: System String
Name of the partition that identifies the sequence containing the number to be changed.
Type: System Int32
Number to be changed; there must already be an element with that number in the sequence.
Type: System Int32
Number to change to; no element must have this number yet in the sequence.

Return Value

A collection of elements affected by the change of the number


This method gives the caller the ability to overwrite any number used in a given numbering sequence as long as the new number does not exist in the same sequence yet. If an attempt is made to replace a number by another that already exists, an exception will be thrown.

The new number will automatically be applied to all elements that bear the original number, thus those elements must be free to be modified. A collection of element Ids of all the affected elements is returned by this method.

The method is independent of the sequence's current starting number that might have been assigned previously, meaning that the new number will be accepted even if it is lower than the previously set start number in the sequence.


Exception Condition
Autodesk.Revit.Exceptions ArgumentException The sequence partition does not exist in the schema. -or- The specified sequence does not contain any elements with the given fromNumber. -or- There already are elements with the given toNumber in the specified sequence.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL
Autodesk.Revit.Exceptions ArgumentOutOfRangeException The value of toNumber must be in the range from 1 to the maximum value for an Integer type
Autodesk.Revit.Exceptions InvalidOperationException Either the schema or its document cannot be modified at present.

See Also