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.
Extends
Section titled “Extends”Properties
Section titled “Properties”entityId
Section titled “entityId”
readonlyentityId:number
Identifier that stays the same for the entity’s lifetime, including across undo and redo.
Inherited from
Section titled “Inherited from”isDeleted
Section titled “isDeleted”
readonlyisDeleted:boolean
Whether the entity was deleted, for example by an edit or by undo.
Inherited from
Section titled “Inherited from”isValid
Section titled “isValid”
readonlyisValid:boolean
Whether the entity still exists in the model.
Inherited from
Section titled “Inherited from”name:
string
Layer name; names needn’t be unique.
readonlytype:"Layer"
The concrete class name, for narrowing unions such as AnyElement.
Overrides
Section titled “Overrides”visible
Section titled “visible”visible:
boolean
Whether the layer’s elements show.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”Set Signature
Section titled “Set Signature”set color(
value):void
Parameters
Section titled “Parameters”Color | { a?: number; b: number; g: number; r: number; }
Returns
Section titled “Returns”void
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”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" }.
Returns
Section titled “Returns”object
entityId
Section titled “entityId”entityId:
number
optionalname?:string
type:
"Material"|"Vertex"|"Edge"|"Face"|"Loop"|"EdgeUse"|"Curve"|"ArcCurve"|"ComponentDefinition"|"ComponentInstance"|"Group"|"Layer"|"Guide"|"Text"|"LinearDimension"|"SectionPlane"