insertElement Method

Insert a new element into the iModel.

insertElement(elProps: ElementProps): string

@returns The newly inserted element's Id.

@throws IModelError if unable to insert the element.

@note For convenience, the value of elProps.id is updated to reflect the resultant element's id. However when elProps.federationGuid is not present or undefined, a new Guid will be generated and stored on the resultant element. But the value of elProps.federationGuid is not updated. Generally, it is best to re-read the element after inserting (e.g. via IModelDb.Elements.getElementProps) if you intend to continue working with it. That will ensure its values reflect the persistent state.

Parameter Type Description
elProps ElementProps The properties of the new element.

Returns - string

The newly inserted element's Id.

Defined in

Last Updated: 14 November, 2024