Hide menu
Loading...
Searching...
No Matches
Assembly

Defines a group of model elements.

Direct children of an assembly are always instances which can refer to nested sub-assemblies, parts, or any other referenced model element already wrapped into an instance.

Extends

Constructors

Constructor

new Assembly(name?): Assembly

Creates a model element with an optional name.

Parameters

name?

string | null

Name assigned to the model element.

Returns

Assembly

Inherited from

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


instances

Get Signature

get instances(): ReadonlySet<Instance>

Returns the direct child instances.

Returns

ReadonlySet<Instance>


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


numberOfInstances

Get Signature

get numberOfInstances(): number

Returns the number of direct child instances.

Deprecated

Use Assembly.instances and instances.size instead.

Returns

number


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 assembly by calling visitAssemblyEnter(). If it returns true, all child instances are visited. The assembly is then left by calling visitAssemblyLeave().

Parameters

visitor

ModelElementVisitor

Visitor to accept.

Returns

void

Overrides

ModelElement.accept


addInstance()

Adds a child model element to the assembly.

Assemblies may only have instances as direct children. If element is not an instance, an interim instance is created which refers to it.

Parts and assemblies may be added to multiple assemblies to be shared. However, they should be referred to by unique instances when added to parent assemblies. Reusing the same instance in multiple parents creates an invalid model object with undefined subsequent behavior.

Param

Model element or instance to add.

Param

Transformation assigned to the created instance when element is not an instance.

Param

Name assigned to the created instance when element is not an instance.

Call Signature

addInstance(element): Instance

Adds an instance as a direct child of the assembly.

If element is already present in the assembly, it is not added again.

Parameters

element

Instance

Instance to add.

Returns

Instance

Call Signature

addInstance(element, transformation?, instanceName?): Instance

Adds a part or sub-assembly to the assembly.

Assemblies may only have instances as direct children. Therefore, a new interim instance is created which refers to element.

Parts and assemblies may be added to multiple assemblies to be shared. However, they should be referred to by unique instances when added to parent assemblies. Reusing the same instance in multiple parents creates an invalid model object with undefined subsequent behavior.

Parameters

element

Part | Assembly

Part or assembly to add.

transformation?

Transformation | null

Transformation assigned to the created instance.

instanceName?

string | null

Name assigned to the created instance.

Returns

Instance


removeInstance()

removeInstance(instance): boolean

Removes an instance from the assembly.

Parameters

instance

Instance

Instance to remove.

Returns

boolean