Hide menu
Loading...
Searching...
No Matches
Instance

Defines an occurrence of a referenced model element in a scene graph.

An instance typically refers to a part or an assembly and is used to share model data while carrying its own transformation and metadata.

Extends

Constructors

Constructor

new Instance(reference?, transformation?, name?): Instance

Creates an instance with an optional reference, transformation, and name.

If reference is an instance, its reference is stored instead. If transformation is provided, its value is copied into the instance.

Parameters

reference?

ModelElement | null

Referenced element.

transformation?

Transformation | null

Transformation assigned to the instance.

name?

string | null

Name of the instance.

Returns

Instance

Overrides

ModelElement.constructor

Properties

material

material: VisualMaterial | null = null

Visual material assigned to the model element.

The default value is null.

Inherited from

ModelElement.material

Accessors

id

Get Signature

get id(): bigint

Returns the unique identifier of the object.

Returns

bigint

Inherited from

ModelElement.id


name

Get Signature

get name(): string | null

Name of the model element.

The default value is null.

Returns

string | null

Set Signature

set name(name): void

Sets the name of the model element.

Parameters

name

string | null

Model element name.

Returns

void

Inherited from

ModelElement.name


reference

Get Signature

get reference(): ModelElement | null

Referenced object.

The default value is null.

Returns

ModelElement | null

Set Signature

set reference(reference): void

Sets the referenced object.

If reference is an instance, its reference is stored instead. Otherwise, the provided element or null is stored as-is.

Parameters

reference

ModelElement | null

Referenced object.

Returns

void


transformation

Get Signature

get transformation(): Transformation

Returns the transformation matrix.

If a transformation has not been explicitly assigned, this getter creates and explicitly assigns an identity transformation.

Returns

Transformation

Set Signature

set transformation(transformation): void

Sets the transformation matrix.

The input value is copied into the instance to preserve value semantics.

Parameters

transformation

Transformation

Transformation matrix.

Returns

void


uuid

Get Signature

get uuid(): `${string}-${string}-${string}-${string}-${string}` | null

UUID of the model element.

The default value is null.

Returns

`${string}-${string}-${string}-${string}-${string}` | null

Set Signature

set uuid(uuid): void

Sets the UUID of the model element.

Parameters

uuid

`${string}-${string}-${string}-${string}-${string}` | null

Model element UUID.

Returns

void

Inherited from

ModelElement.uuid

Methods

accept()

accept(visitor): void

Accepts an element visitor.

First enters the instance by calling visitInstanceEnter(). If it returns true, the referenced element is visited. The instance is then left by calling visitInstanceLeave().

Parameters

visitor

ModelElementVisitor

Visitor to accept.

Returns

void

Overrides

ModelElement.accept


hasTransformation()

hasTransformation(): boolean

Returns whether the instance has an explicitly attached transformation matrix.

Returns true after a transformation has been assigned directly or created implicitly through the transformation getter.

Returns

boolean