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.
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.
ModelElement | null
Referenced element.
Transformation | null
Transformation assigned to the instance.
string | null
Name of the instance.
Instance
material:
VisualMaterial|null=null
Visual material assigned to the model element.
The default value is null.
get id():
bigint
Returns the unique identifier of the object.
bigint
get name():
string|null
Name of the model element.
The default value is null.
string | null
set name(
name):void
Sets the name of the model element.
string | null
Model element name.
void
get reference():
ModelElement|null
Referenced object.
The default value is null.
ModelElement | null
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.
ModelElement | null
Referenced object.
void
get transformation():
Transformation
Returns the transformation matrix.
If a transformation has not been explicitly assigned, this getter creates and explicitly assigns an identity transformation.
set transformation(
transformation):void
Sets the transformation matrix.
The input value is copied into the instance to preserve value semantics.
Transformation matrix.
void
get uuid():
`${string}-${string}-${string}-${string}-${string}`|null
UUID of the model element.
The default value is null.
`${string}-${string}-${string}-${string}-${string}` | null
set uuid(
uuid):void
Sets the UUID of the model element.
`${string}-${string}-${string}-${string}-${string}` | null
Model element UUID.
void
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().
Visitor to accept.
void
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.
boolean