AssignElementsToSequence Method


Assigns the input elements to a sequence identified by the given partition name.

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

Syntax

C#
public void AssignElementsToSequence(
	ISet<ElementId> elementIds,
	string partitionName
)
Visual Basic
Public Sub AssignElementsToSequence ( _
	elementIds As ISet(Of ElementId), _
	partitionName As String _
)
Visual C++
public:
void AssignElementsToSequence(
	ISet<ElementId^>^ elementIds, 
	String^ partitionName
)

Parameters

elementIds
Type: System.Collections.Generic ISet ElementId
Ids of elements which are to be added to a sequence. All elements must be valid and belonging to this schema.
partitionName
Type: System String
Name of the target sequence's partition

Remarks

Elements will be added to the sequence by changing the value of their Partition parameter. The difference between this method and changing the parameter value explicitly is that the method here causes sequences to get assigned and renumbered automatically and immediately without needing to commit a transaction first.

A numbering sequence for the given partition does not need to exist yet; it will get created automatically by this method as needed.

The elements' numbers are likely to be affected by this operation, which is to be expected. The values of assigned numbers will depend on whether the given sequence already exists or not. In both cases the elements will get renumbered in order of their original creation, but the first value will be 1 if the sequence does not exist yet, respectively the next highest number if the sequence does exist already. The general matching policy is always applied causing matched elements to have the same number.

A special case is considered when the given elements are all the elements of one sequence and are being assigned to a sequence that does not exist yet. Such an operation is identical in effect to the MoveSequence method and all the elements will keep their numbers unchanged.

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentException the given partitionName cannot be used as a valid name of a numbering partition because it contains characters that are considered invalid, such as non-printable characters or those that cannot be used in a file's name. -or- Thrown when elementIds contains Ids that are either invalid or of elements not from this schema.
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was null
Autodesk.Revit.Exceptions InvalidOperationException Either the schema or its document cannot be modified at present. -or- Thrown if there is an element that cannot have new value of the NUMBER_PARTITION_PARAM parameter assigned. It may be an indication that the element is not free to be edited at present.

See Also