Autodesk.Viewing.Model
new Model()
Core class representing the geometry.
Methods
fetchTopology(maxSizeMB)
Downloads the topology file, if one is available. The file may not get downloaded if the topology content size in memory is bigger than a specified limit (100 MB by default, 20 MB for mobile).
Parameters
| maxSizeMB* number | Maximum uncompressed topology size allowed (in MegaBytes). |
Returns
| Type | Description |
|---|---|
| Promise | that resolves with the topology object. |
geomPolyCount()
Returns the polygon count.
Returns
| Type | Description |
|---|---|
| number |
getBoundingBox()
Returns
| Type | Description |
|---|---|
| THREE.Box3 | Bounding box of the model if available, otherwise null. |
getBulkProperties(dbIds,options,onSuccessCallback,onErrorCallback)
Returns properties for multiple objects with an optional filter on which properties to retrieve.
Parameters
| dbIds* array.<int> | IDs of the nodes to return the properties for. |
| options* object|undefined | Dictionary with options. |
| propFilter array.<string> | Array of property names to return values for. Use null for no filtering. Filter applies to “name” and “externalId” fields also. |
| ignoreHidden boolean | Ignore hidden properties |
| onSuccessCallback* function | This method is called when request for property db succeeds. |
| onErrorCallback* function | This method is called when request for property db fails. |
getData()
Returns the geometry data.
getDefaultCamera()
Returns the default camera.
getDisplayUnit()
Returns a standard string representation of the model’s display unit.
Returns
| Type | Description |
|---|---|
| string | Standard representation of model’s display unit or null if it is not known. |
getDocumentNode()
Returns an object wrapping the bubble/manifest entry for the loaded geometry. Contains data such as the viewableID, guid, role…
getExternalIdMapping(onSuccessCallback,onErrorCallback)
Returns an object with key values being dbNodeIds and values externalIds. Useful to map LMV node ids to Fusion node ids.
Parameters
| onSuccessCallback* function | This method is called when request for property db succeeds. |
| onErrorCallback* function | This method is called when request for property db fails. |
getFastLoadList()
Helper functions for fastLoad
getFragmentMap()
Returns
| Type | Description |
|---|---|
| DbidFragmentMap|InstanceTree | Maps dbIds to fragment ids. |
getInstanceTree()
Returns
| Type | Description |
|---|---|
| InstanceTree | Instance tree of the model if available, otherwise null. |
getLayersRoot()
Returns the root of the layers tree.
Not yet implemented in 3D.
Returns
| Type | Description |
|---|---|
| object | The root of the layers tree or null if it doesn’t exist. |
getMetadata(itemName,subitemName,defaultValue)
Return metadata value.
Parameters
| itemName* string | Metadata item name. |
| subitemName string | Metadata subitem name. |
| defaultValue * | Default value. |
Returns
| Type | Description |
|---|---|
| * | Metadata value, or defaultValue if no metadata or metadata item/subitem does not exist. |
getObjectTree(onSuccessCallback,onErrorCallback)
Returns object tree.
Parameters
| onSuccessCallback* function | This method is called when request for object tree succeeds. |
| onErrorCallback* function | This method is called when request for object tree fails. |
getProperties(dbId,onSuccessCallback,onErrorCallback)
Returns object properties.
Parameters
| dbId* int | ID of the node to return the properties for. |
| onSuccessCallback* function | This method is called when request for property db succeeds. |
| onErrorCallback* function | This method is called when request for property db fails. |
getRoot()
Returns the root of the geometry node graph.
Returns
| Type | Description |
|---|---|
| object | The root of the geometry node graph. Null if it doesn’t exist. |
getRootId()
Returns the root of the geometry node graph.
Returns
| Type | Description |
|---|---|
| number | The ID of the root or null if it doesn’t exist. |
getTopoIndex(fragId)
Return topology index of the fragment.
Parameters
| fragId* number | Fragment ID. |
Returns
| Type | Description |
|---|---|
| number | Topology index. |
getTopology(index)
Return topology data of one fragment.
Requires topology data to have been fetched with fetchTopology().
Parameters
| index* number | Topology index. |
Returns
| Type | Description |
|---|---|
| object | Topology data. |
getUnitData(unit)
Returns an object that contains the standard unit string (unitString) and the scale value (unitScale).
Parameters
| unit* string | Unit name from the metadata |
Returns
| Type | Description |
|---|---|
| object | This object contains the standardized unit string (unitString) and a unit scaling value (unitScale) |
getUnitScale()
Returns the scale factor of model’s distance unit to meters.
Returns
| Type | Description |
|---|---|
| number | The scale factor of the model’s distance unit to meters or unity if the units aren’t known. |
getUnitString()
Returns a standard string representation of the model’s distance unit.
Returns
| Type | Description |
|---|---|
| string | Standard representation of model’s unit distance or null if it is not known. |
getUpVector()
Returns up vector as an array of 3.
hasTopology()
See also fetchTopology().
Returns
| Type | Description |
|---|---|
| boolean | true if topology data has been downloaded and is available in memory |
instancePolyCount()
Returns the instanced polygon count.
Returns
| Type | Description |
|---|---|
| number |
is2d()
Returns
| Type | Description |
|---|---|
| boolean | Whether the model is 2D. |
is3d()
Returns
| Type | Description |
|---|---|
| boolean | Whether the model is 3D. |
isAEC()
Returns whether the “AEC” loader settings were used when loading the model
isLoadDone()
Returns true if the model with all its geometries has loaded.
Returns
| Type | Description |
|---|---|
| boolean |
isObjectTreeCreated()
Returns true if the frag to node id mapping is done.
Returns
| Type | Description |
|---|---|
| boolean |
isObjectTreeLoaded()
Returns true only when the object tree is loaded into memory. Will return false while the object tree is still loading, or when the object tree fails to load.
Available since version 2.13
Returns
| Type | Description |
|---|---|
| boolean |
pageToModel()
Paper coordinates to Model coordinates
pointInClip()
Find the viewports that point lies in its bounds.
search(text,onSuccessCallback,onErrorCallback,attributeNames)
Searches the object property database.
Parameters
| text* string | The search term (not case sensitive). |
| onSuccessCallback* function | This method is called when request for search succeeds. |
| onErrorCallback* function | This method is called when request for search fails. |
| attributeNames Array.<string> | Restricts search to specific attribute names. |
setData(data)
Set the geometry data.
Parameters
| data* object | Data that represents the geometry. |
setUUID(urn)
Set a UUID to identify the SVF model
Parameters
| urn* string | Data that represents the geometry. |