Provides Manufacturing Toolkit (MTK) data model.
The model encapsulates a scene graph (hierarchy of assemblies and parts) and is thus an entry point to entire 3D model data.
The model object can be restored from a file in native MTK format.
new Model(
name
?):Model
Name of the model.
null
| string
get id():
bigint
Returns object id.
bigint
get name():
null
|string
Returns name of the model. null
if the model has no name (by default).
null
| string
set name(
name
):void
Sets name of the model.
Name of the model.
null
| string
void
get numberOfRoots():
number
Returns number of model's root elements.
Deprecated. Use roots.size instead.
number
Returns a set of model's root elements. The elements it contains can only be instances of assemblies or parts.
accept(
visitor
):void
Accepts an element visitor that will visit all root elements.
See also ModelElement::accept.
Accepted visitor.
void
Adds new root to the model. If the passed element already presents as a model root, it won't be added. Only assemblies and parts can be assigned as roots. If instance is passed, new assembly will be created and added as root. Passed instance will be added to this assembly.
The root element.
addRoot(
root
):void
Adds new root to the model. If the passed element already presents as a model root, it won't be added. Only assemblies and parts can be assigned as roots. Thus new assembly will be created and added as root. Passed instance will be added to this assembly.
The root element.
void
The root element.
addRoot(
root
):void
Adds new root to the model. If the passed element already presents as a model root, it won't be added.
The root element.
void
The root element.
clear():
this
Cleans up contents of this
object, but saves the assigned name.
this
isEmpty():
boolean
Returns true
if model is empty, i.e. contains no root elements. Otherwise returns false
.
boolean
merge(
model
):this
Merges another model
to this
object:
model
to this
object roots.this
object.Merged model.
this
open(
filename
,dataProvider
):Promise
<boolean
>
Reads the MTKWEB model to this
model. Returns true
if the reading process succeeded, false
otherwise.
string
Name of the MTKWEB file.
Provider for data stored in external files.
Promise
<boolean
>
openFromBuffer(
data
,dataProvider
):Promise
<boolean
>
Reads the MTKWEB model to this
model. Returns true
if the reading process succeeded, false
otherwise.
ArrayBufferLike
Buffer with model data.
Provider for data stored in external files.
Promise
<boolean
>
true
if the reading process succeeded, false
otherwise.