Skip to content

ComponentInstance

One placement of a component definition.

readonly definition: ComponentDefinition

The definition this instance places.


readonly entityId: number

Identifier that stays the same for the entity’s lifetime, including across undo and redo.

DrawingElement.entityId


hidden: boolean

The element’s own hidden flag; assign inside Model.operation. Hidden ancestors are not taken into account; use Model.isDrawingElementVisible for that.

DrawingElement.hidden


readonly isDeleted: boolean

Whether the entity was deleted, for example by an edit or by undo.

DrawingElement.isDeleted


readonly isValid: boolean

Whether the entity still exists in the model.

DrawingElement.isValid


readonly material: Material | null

The material applied to the whole instance, or null.


name: string

Name of this placement only; assign inside Model.operation.


transformation: Transformation

Maps definition-local coordinates into the parent context. Assigning replaces the placement; do so inside Model.operation.


readonly type: "ComponentInstance"

The concrete class name, for narrowing unions such as AnyElement.

DrawingElement.type


visible: boolean

The inverse of hidden; assign inside Model.operation.

DrawingElement.visible

transform(transformation): void

Applies a transformation in the parent context, so the new placement is transformation.multiply(old). Call it inside Model.operation.

Transformation

void