Skip to content

Vibe coding a plugin? Teach your agent Modlumi first. Works with Claude Code, Codex, Cursor and more.

Layer

A named display group of drawing elements. Hiding a layer hides the faces, edges, guides and annotations on it, and every group and instance on it with all of its contents. Elements with no layer are on the default layer, which has no Layer and is always shown. Layers only change what shows: geometry on different layers still connects. Add layers with Model.addLayer; change their properties inside Model.operation. Needs the "layers" feature.

readonly entityId: number

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

Entity.entityId


readonly isDeleted: boolean

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

Entity.isDeleted


readonly isValid: boolean

Whether the entity still exists in the model.

Entity.isValid


name: string

Layer name; names needn’t be unique.


readonly type: "Layer"

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

Entity.type


visible: boolean

Whether the layer’s elements show.

get color(): Color

The layer’s color in the Layers panel: red, green, blue and alpha, each from 0 to 1. Assigning accepts a color without a, which is then 1.

Color

set color(value): void

Color | { a?: number; b: number; g: number; r: number; }

void

toJSON(): object

JSON.stringify writes the entity as its type and entityId, plus its name when it has one, such as { "type": "Group", "entityId": 12, "name": "Wheel" }.

object

entityId: number

optional name?: string

type: "Material" | "Vertex" | "Edge" | "Face" | "Loop" | "EdgeUse" | "Curve" | "ArcCurve" | "ComponentDefinition" | "ComponentInstance" | "Group" | "Layer" | "Guide" | "Text" | "LinearDimension" | "SectionPlane"

Entity.toJSON