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

Defines an occurrence of part or assembly in a scene graph.

Instance contains a reference to another element part or assembly and is used to share data, e.g. two instances can share the same part adding own transformations.

Extends

Constructors

Constructor

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

Parameters

reference?

Referenced element.

Part | Assembly | Instance | null

transformation?

Transformation of the referenced element.

Transformation | null

name?

Name of the instance.

string | null

Returns

Instance

Overrides

ModelElement.constructor

Properties

material

material: VisualMaterial | null = null

The model element material. null if the element has no material (by default).

Inherited from

ModelElement.material

Accessors

id

Get Signature

get id(): bigint

Returns object id.

Returns

bigint

Inherited from

ModelElement.id


name

Get Signature

get name(): string | null

Returns name of the model element. null if the element has no name (by default).

Returns

string | null

Set Signature

set name(name): void

Sets name of the model element.

Parameters

name

Name of the model element.

string | null

Returns

void

Inherited from

ModelElement.name


reference

Get Signature

get reference(): ModelElement | null

Returns the referenced object. null if the instance does not refer to any object (by default).

Returns

ModelElement | null

Set Signature

set reference(reference): void

Sets referenced object.

  • If reference represents part or assembly or null, then sets its as this object reference.
  • If reference represents instance, then sets its reference as this object reference.
  • Otherwise nothing happens.

Parameters

reference

Referenced object.

ModelElement | null

Returns

void


transformation

Get Signature

get transformation(): Transformation

Returns the transformation matrix.

If the matrix has not been explicitly assigned, then creates and explicitly assigns an identity matrix.

Returns

Transformation

Set Signature

set transformation(transformation): void

Sets transformation matrix.

Parameters

transformation

Transformation

Transformation matrix.

Returns

void


uuid

Get Signature

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

Returns uuid of the model element. null if the element has no assigned uuid (by default).

Returns

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

Set Signature

set uuid(uuid): void

Sets uui of the model element.

Parameters

uuid

Uuid of the model element.

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

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 then visits the referred element. Then leaves the instance calling visitInstanceLeave()

Parameters

visitor

ModelElementVisitor

Accepted visitor.

Returns

void

Overrides

ModelElement.accept


hasTransformation()

hasTransformation(): boolean

Returns true if the instance has an explicitly attached transformation matrix, false otherwise.

Returns

boolean