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

Defines a group of model elements.

Direct children of assembly are always instances which can refer to nested sub-assemblies or parts.

Extends

Constructors

Constructor

new Assembly(name?): Assembly

Parameters

name?

Name of the model element.

string | null

Returns

Assembly

Inherited from

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


instances

Get Signature

get instances(): ReadonlySet<Instance>

Returns a set of child instances.

Returns

ReadonlySet<Instance>


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


numberOfInstances

Get Signature

get numberOfInstances(): number

Returns number of child instances.

Deprecated. Use instances.size instead.

Deprecated

Returns

number


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 assembly by calling visitAssemblyEnter(). If it returns true then visits all the assembly children. Then leaves the assembly calling visitAssemblyLeave().

Parameters

visitor

ModelElementVisitor

Accepted visitor.

Returns

void

Overrides

ModelElement.accept


addInstance()

Adds a new child element into the assembly.

Assemblies may only have instances as direct children. If element is not an instance (i.e. is a part or an assembly) an interim instance is created which will refer to the element.

Parts and assemblies may be added to multiple assemblies to be shared. However they must be referred by unique instances when adding to parent assemblies, i.e. each instance may not be added as a child into more than one assembly. Otherwise this will create an invalid model object which undefined subsequent behavior.

Param

Added part or assembly.

Param

Transformation of the element.

Param

Name of the element instance.

Call Signature

addInstance(element): Instance

Adds a new child element into the assembly. If the instance already presents in this object children, it won't be added.

Parameters

element

Instance

Added instance.

Returns

Instance

Added or already existed instance.

Call Signature

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

Adds a new child element into the assembly.

Assemblies may only have instances as direct children. Thus an interim instance is created which will refer to the element.

Parts and assemblies may be added to multiple assemblies to be shared. However they must be referred by unique instances when adding to parent assemblies, i.e. each instance may not be added as a child into more than one assembly. Otherwise this will create an invalid model object which undefined subsequent behavior.

Parameters

element

Added part or assembly.

Part | Assembly

transformation?

Transformation of the element.

Transformation | null

instanceName?

Name of the element instance.

string | null

Returns

Instance

Newly created instance.


removeInstance()

removeInstance(instance): boolean

Removes specific instance from assembly. Returns true if instance was removed, false otherwise.

Parameters

instance

Instance

Returns

boolean