Create Method


Creates a new assembly instance.

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

Syntax

C#
public static AssemblyInstance Create(
	Document document,
	ICollection<ElementId> assemblyMemberIds,
	ElementId namingCategoryId
)
Visual Basic
Public Shared Function Create ( _
	document As Document, _
	assemblyMemberIds As ICollection(Of ElementId), _
	namingCategoryId As ElementId _
) As AssemblyInstance
Visual C++
public:
static AssemblyInstance^ Create(
	Document^ document, 
	ICollection<ElementId^>^ assemblyMemberIds, 
	ElementId^ namingCategoryId
)

Parameters

document
Type: Autodesk.Revit.DBDocument
The document containing the elements.
assemblyMemberIds
Type: System.Collections.GenericICollectionElementId
The elements that comprise the assembly.
namingCategoryId
Type: Autodesk.Revit.DBElementId
The naming category for the assembly instance.

Return Value

The newly created assembly instance.

Remarks

Transaction must be committed after calling this method before performing any action on the newly created instance. Assembly type is assigned after the transaction for creating assembly instance is complete.

Exceptions

ExceptionCondition
Autodesk.Revit.ExceptionsArgumentException One or more element ids was not permitted for membership in the assembly instance. Elements should be of a valid category and should not be a member of an existing assembly. -or- This naming category was not valid for an assembly instance containing the proposed members. The naming category should match one of the member element categories.
Autodesk.Revit.ExceptionsArgumentNullException A non-optional argument was null
Autodesk.Revit.ExceptionsInvalidOperationException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements).
Autodesk.Revit.ExceptionsModificationForbiddenException The document is in failure mode: an operation has failed, and Revit requires the user to either cancel the operation or fix the problem (usually by deleting certain elements). -or- The document is being loaded, or is in the midst of another sensitive process.
Autodesk.Revit.ExceptionsModificationOutsideTransactionException The document has no open transaction.

See Also