Skip to content

Model

The document the script runs against. Get it from activeModel.

readonly activeEntities: Entities

The entities of the context being edited, such as an open group.


readonly activeView: View

The view for image export.


readonly definitions: readonly ComponentDefinition[]

All component and group definitions.


readonly entities: Entities

The entities at the model root.


readonly materials: readonly Material[]

All materials.


readonly selection: Selection

The current selection.

isDrawingElementVisible(path, options?): boolean

Whether an element is visible, taking hidden ancestors into account. path lists the element’s ancestors from the model root down to the element itself.

readonly DrawingElement[]

VisibilityOptions

boolean


operation<T>(name, body): T

Runs body as one named undo step and returns its result. Every edit must happen inside an operation. A thrown error, or any failed edit inside body (even when caught), rolls the whole operation back. Empty operations add no undo step. Operations can’t be nested, and body must be synchronous.

T

string

() => T

T


redo(): void

Redoes the last undone operation. Not allowed inside an operation.

void


undo(): void

Undoes the last operation. Not allowed inside an operation.

void