Creating ElementAspects

Use IModelDb.Elements.insertAspect to insert a new ElementAspect into an IModelDb. This method takes as its input an ElementAspectProps or a subclass of it, which defines the class and all required properties of the new ElementAspect. The pattern is:

const aspectProps = {
  classFullName: "SomeDomain:SomeAspectClass",
  element: { id: elementId },
  stringProp: "s1",
  numberProp: 1,
};
iModel.elements.insertAspect(aspectProps);

Last Updated: 15 May, 2024