Accessing Elements in an IModelDb
An iTwin.js Element is an in-memory representation of a BIS Element. An Element object provides easy access to a set of properties and Aspects.
IModelDb.elements represents the collection of Elements in an iModel.
Every iModel contains a single "root" Subject element that is the parent of all partitions. It is accessed by a special function called IModelDb.Elements.getRootSubject.
You can look up all other elements in various ways. As described in BIS Element Fundamentals, an element is identified by a unique Id and may also have a Code and/or a FederationGuid. If you know one of these identifiers, you can look up an element very efficiently. The IModelDb.Elements.getElement method makes that easy.
You can discover an element's Id by using ECSQL to query other properties or spatial queries.
Last Updated: 13 May, 2024