AssemblyInstanceCreate Method |
Creates a new assembly instance.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static AssemblyInstance Create(
Document document,
ICollection<ElementId> assemblyMemberIds,
ElementId namingCategoryId
)
Public Shared Function Create (
document As Document,
assemblyMemberIds As ICollection(Of ElementId),
namingCategoryId As ElementId
) As AssemblyInstance
public:
static AssemblyInstance^ Create(
Document^ document,
ICollection<ElementId^>^ assemblyMemberIds,
ElementId^ namingCategoryId
)
static member Create :
document : Document *
assemblyMemberIds : ICollection<ElementId> *
namingCategoryId : ElementId -> AssemblyInstance
Parameters
- document Document
-
The document containing the elements.
- assemblyMemberIds ICollectionElementId
-
The elements that comprise the assembly.
- namingCategoryId ElementId
-
The naming category for the assembly instance.
Return Value
AssemblyInstance
The newly created assembly instance.
ExceptionsException | Condition |
---|
ArgumentException |
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.
|
ArgumentNullException |
A non-optional argument was null
|
InvalidOperationException |
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).
|
ModificationForbiddenException |
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.
|
ModificationOutsideTransactionException |
The document has no open transaction.
|
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.
See Also