Hide menu
Loading...
Searching...
No Matches
Model

Provides Manufacturing Toolkit (MTK) data model.

The model encapsulates a scene graph of model elements and is thus an entry point to the entire 3D model data.

The model may also contain associated drawing data.

Extends

Constructors

Constructor

new Model(name?): Model

Creates a model with an optional name.

Parameters

name?

string | null

Name assigned to the model.

Returns

Model

Overrides

BaseObject.constructor

Properties

drawing

drawing: Drawing | null = null

Drawing data associated with the model.

The default value is null.

Accessors

id

Get Signature

get id(): bigint

Returns the unique identifier of the object.

Returns

bigint

Inherited from

BaseObject.id


name

Get Signature

get name(): string | null

Name of the model.

The default value is null.

Returns

string | null

Set Signature

set name(name): void

Sets the name of the model.

Parameters

name

string | null

Model name.

Returns

void


numberOfRoots

Get Signature

get numberOfRoots(): number

Returns the number of root elements in the model.

Deprecated

Use Model.roots and roots.size instead.

Returns

number


roots

Get Signature

get roots(): ReadonlySet<ModelElement>

Root elements currently stored in the model.

Returns

ReadonlySet<ModelElement>

Methods

accept()

accept(visitor): void

Accepts an element visitor for all root elements.

See also ModelElement.accept.

Parameters

visitor

ModelElementVisitor

Visitor to accept.

Returns

void


addRoot()

addRoot(root): void

Adds a root element to the model.

If root is an instance, a new root assembly is created and the instance is added to it. Any other model element is added as a root directly.

Parameters

root

ModelElement

The root element.

Returns

void


assignUuids()

assignUuids(): this

Assigns fresh random UUIDs to model elements and associated drawing entities.

Each unique model element receives a single UUID even if it is reached multiple times through different instances. If drawing data is present, sheets, views, layers, drawing elements, and hatch contours also receive fresh UUIDs.

Returns

this


clear()

clear(): this

Clears the contents of the model while preserving its assigned name.

Returns

this


isEmpty()

isEmpty(): boolean

Returns whether the model contains no root elements.

Returns

boolean


merge()

merge(model): this

Merges another model into this model.

  • Adds root elements of model to this model.
  • Keeps the name of this model unchanged.

Parameters

model

Model

Model to merge.

Returns

this


open()

open(filename, dataProvider): Promise<boolean>

Reads an MTKWEB model into this model.

Parameters

filename

string

Name of the MTKWEB file.

dataProvider

DataProvider

Provider used to load data stored in external files.

Returns

Promise<boolean>