Manual Reference Source

Function

Static Public Summary
public

activate(commentId: number): *

Make a model comment in current viewer to be the current comment.

public

compare(modelId1: string, modelId2: string): Promise<newElements1, newElements2, updatedElements1, updatedElements2, Error>

Compare two models.

public

create(modelId: string, extData: Object): Promise<Comment, Error>

Create a model comment with model id and extData.

public

Generate a 3D PDF file from a model.

public

get(modelId: string): Promise<Model, Error>

Get information of a model.

public

get(modelId: string): Pormise<Comment[], Error>

Get all model comments with model id.

public

get(assetId: string): Promise<Asset, Error>

Get information of an asset.

public

Get url of a 3D PDF.

public

Get all BIM properties of a single element.

public

Get common BIM properties of some elements.

public

Get the BIM structure of a model.

public

init(config: InitConfig)

Initialize and configure Modelo API.

public

merge(name: string, modelIds: string[]): Promise<string, Error>

Merge several models together into one model.

public

Remove a model.

public

Remove an asset.

public

remove(commentId: number): Promise<number, Error>

Remove a model comment.

public

update(modelId: string, name: string): Promise<string, Error>

Rename the model.

public

update(assetId: string, name: string): Promise<string, Error>

Rename the asset.

public

update(commentId: number, extData: Object): Promise<number, Error>

Update user-defined data in a model comment.

public

updateElementProperty(modelId: string, elementId: string, property: {name: string, groupKey: number, strValue: ?string, numValue: ?number}): Promise<BIMProperty, Error>

Update the value of one BIM property of a single element.

public

updateElementsProperty(modelId: string, elementIds: number, property: {name: string, groupKey: number, strValue: ?string, numValue: ?number}): Promise<BIMProperty, Error>

Update the value of a common property of some elements.

public

upload(file: File, onProgress: function(progress: number): void): Promise<Asset, Error>

Upload an asset to cloud.

public

upload(file: File, onProgress: function(progress: number): void): Promise<Model, Error>

Upload a model.

Static Public

public activate(commentId: number): * source

import {activate} from '@modelo/api/doc/Comment/Comment.js'

Make a model comment in current viewer to be the current comment. It will change the current view angle to the one when comment was created.

Notes:

  1. this function is only available after a 3D viewer loaded.

Params:

NameTypeAttributeDescription
commentId number

comment id

Return:

*

void

public compare(modelId1: string, modelId2: string): Promise<newElements1, newElements2, updatedElements1, updatedElements2, Error> source

import {compare} from '@modelo/api/doc/Model/Model.js'

Compare two models. If succeed, the function returns the difference. The difference includes new elements in model1, new elements in model2, updated elements in model1 and updated elements in model2, each of which are stored in an array of element IDs.

Params:

NameTypeAttributeDescription
modelId1 string

The id of model1

modelId2 string

The id of model2

Return:

Promise<newElements1, newElements2, updatedElements1, updatedElements2, Error>

public create(modelId: string, extData: Object): Promise<Comment, Error> source

import {create} from '@modelo/api/doc/Comment/Comment.js'

Create a model comment with model id and extData.

Notes:

  1. this function is only available after a 3D viewer loaded.
  2. extData is used to store user-defined data.

Params:

NameTypeAttributeDescription
modelId string

model id

extData Object
  • optional

user-defined data.

Return:

Promise<Comment, Error>

public generate3DPDF(modelId: string): Promise<number, Error> source

import {generate3DPDF} from '@modelo/api/doc/Model/Model.js'

Generate a 3D PDF file from a model. The exporting takes a while and this function returns immediately when the requests is sent to backend server succesfully. One needs to call get3DPDFURL to poll the exported 3D PDF's download URL.

Params:

NameTypeAttributeDescription
modelId string

model id

Return:

Promise<number, Error>

public get(modelId: string): Promise<Model, Error> source

import {get} from '@modelo/api/doc/Model/Model.js'

Get information of a model.

Params:

NameTypeAttributeDescription
modelId string

Return:

Promise<Model, Error>

public get(modelId: string): Pormise<Comment[], Error> source

Get all model comments with model id.

Params:

NameTypeAttributeDescription
modelId string

To fetch all comments regarding this model.

Return:

Pormise<Comment[], Error>

public get(assetId: string): Promise<Asset, Error> source

import {get} from '@modelo/api/doc/Asset/Asset.js'

Get information of an asset. The asset is any other document type than BIM models. It can be a JPEG file, a panorama image, a PDF or even a zip file users want to back up in the cloud.

Params:

NameTypeAttributeDescription
assetId string

The asset id.

Return:

Promise<Asset, Error>

public get3DPDFURL(PDFId: number): Promise<number, Error> source

import {get3DPDFURL} from '@modelo/api/doc/Model/Model.js'

Get url of a 3D PDF. It takes a while to generate the URL after generate3DPDF is called. Users have to poll the URL. Moreover, the URL is a temporary one. It will expire after a short of period of time for secure reason. Users have to download PDF as soon as she has the URL.

Params:

NameTypeAttributeDescription
PDFId number

id of 3D PDF

Return:

Promise<number, Error>

public getElementProperties(modelId: string, elementId: string): Promise<BIMProperty[], Error> source

import {getElementProperties} from '@modelo/api/doc/BIM/BIM.js'

Get all BIM properties of a single element.

Params:

NameTypeAttributeDescription
modelId string

The model id.

elementId string

The element id.

Return:

Promise<BIMProperty[], Error>

An array of BIMProperoty.

public getElementsProperties(modelId: string, elementIds: string[]): Promise<BIMProperty[], Error> source

import {getElementsProperties} from '@modelo/api/doc/BIM/BIM.js'

Get common BIM properties of some elements. Note the values of common properties are not fetched.

Params:

NameTypeAttributeDescription
modelId string

The model id.

elementIds string[]

An array of element ids.

Return:

Promise<BIMProperty[], Error>

An array of BIMProperoty.

public getTreeInfo(modelId: string): Promise<BIMTree, Error> source

import {getTreeInfo} from '@modelo/api/doc/BIM/BIM.js'

Get the BIM structure of a model. The structure is represented in BIMTree which is organized in a tree structure. From the top to bottom, there are BIMModel, BIMLevel, BIMCategory, BIMFamily,
BIMType, BIMType. For example, a model can contain a few levels and a level can contain a few categories. So far so forth.

Params:

NameTypeAttributeDescription
modelId string

The model id.

Return:

Promise<BIMTree, Error>

public init(config: InitConfig) source

import {init} from '@modelo/api/doc/Modelo.js'

Initialize and configure Modelo API.

Params:

NameTypeAttributeDescription
config InitConfig

The configuration object.

public merge(name: string, modelIds: string[]): Promise<string, Error> source

import {merge} from '@modelo/api/doc/Model/Model.js'

Merge several models together into one model. Both geometry and BIM data of the models will be merged. The model's BIM data will become BIMModel in the BIM structure of new model and its model ID is kept as originModelId in BIMModel.

Params:

NameTypeAttributeDescription
name string

The output model name.

modelIds string[]

An array of source model ids.

Return:

Promise<string, Error>

Return new output merged model ID if succeeded.

public remove(modelId: string): Promise<string, Error> source

import {remove} from '@modelo/api/doc/Model/Model.js'

Remove a model.

Params:

NameTypeAttributeDescription
modelId string

The model id.

Return:

Promise<string, Error>

public remove(assetId: string): Promise<string, Error> source

import {remove} from '@modelo/api/doc/Asset/Asset.js'

Remove an asset.

Params:

NameTypeAttributeDescription
assetId string

The asset id

Return:

Promise<string, Error>

return success information when done.

public remove(commentId: number): Promise<number, Error> source

import {remove} from '@modelo/api/doc/Comment/Comment.js'

Remove a model comment.

Params:

NameTypeAttributeDescription
commentId number

The comment id

Return:

Promise<number, Error>

return comment id if removed successfully

public update(modelId: string, name: string): Promise<string, Error> source

import {update} from '@modelo/api/doc/Model/Model.js'

Rename the model.

Params:

NameTypeAttributeDescription
modelId string

The model id.

name string

The new model name.

Return:

Promise<string, Error>

public update(assetId: string, name: string): Promise<string, Error> source

import {update} from '@modelo/api/doc/Asset/Asset.js'

Rename the asset.

Params:

NameTypeAttributeDescription
assetId string

The asset id.

name string

The new asset name.

Return:

Promise<string, Error>

return success information when done.

public update(commentId: number, extData: Object): Promise<number, Error> source

import {update} from '@modelo/api/doc/Comment/Comment.js'

Update user-defined data in a model comment.

Params:

NameTypeAttributeDescription
commentId number

comment id

extData Object

custom user-defined data

Return:

Promise<number, Error>

public updateElementProperty(modelId: string, elementId: string, property: {name: string, groupKey: number, strValue: ?string, numValue: ?number}): Promise<BIMProperty, Error> source

import {updateElementProperty} from '@modelo/api/doc/BIM/BIM.js'

Update the value of one BIM property of a single element.

Params:

NameTypeAttributeDescription
modelId string

The model id.

elementId string

The element id.

property {name: string, groupKey: number, strValue: ?string, numValue: ?number}

The property to be updated. Either strValue or numValue must be valid.

Example:

Modelo.BIM.updateElementProperty(
  "yourModelId",
  "yourElementId",
  { name: "propertyName", groupKey: 3, strValue: 'someValue' }
)
.then(property => {
  // success
})
.catch(error => {
  // error
})

public updateElementsProperty(modelId: string, elementIds: number, property: {name: string, groupKey: number, strValue: ?string, numValue: ?number}): Promise<BIMProperty, Error> source

import {updateElementsProperty} from '@modelo/api/doc/BIM/BIM.js'

Update the value of a common property of some elements.

Params:

NameTypeAttributeDescription
modelId string

The model id

elementIds number

The element ids.

property {name: string, groupKey: number, strValue: ?string, numValue: ?number}

The property to be updated�� Either strValue or numValue must be valid.

public upload(file: File, onProgress: function(progress: number): void): Promise<Asset, Error> source

import {upload} from '@modelo/api/doc/Asset/Asset.js'

Upload an asset to cloud.

Params:

NameTypeAttributeDescription
file File

The file object of the asset.

onProgress function(progress: number): void
  • optional

Progress callback function. It takes number parameter from 0 to 100 that indicates the upload progress.

Return:

Promise<Asset, Error>

return the asset object if upload succeeded.

public upload(file: File, onProgress: function(progress: number): void): Promise<Model, Error> source

import {upload} from '@modelo/api/doc/Model/Model.js'

Upload a model.

Params:

NameTypeAttributeDescription
file File

file object of model.

onProgress function(progress: number): void
  • optional

The progress callback function that takes a number parameter indicates the upload progress.

Return:

Promise<Model, Error>

return model object if upload succeeded.