Request

Response

    Autodesk.Viewing

    Model

    new Model()

    Core class representing the geometry.

    Methods

    getInstanceTree()

    Returns

    typedescription
    InstanceTree Instance tree of the model if available, otherwise null.

    getFragmentMap()

    Returns

    getBoundingBox()

    Returns

    typedescription
    THREE.Box3 Bounding box of the model if available, otherwise null.

    is2d()

    Returns

    typedescription
    boolean Whether the model is 2D.

    is3d()

    Returns

    typedescription
    boolean Whether the model is 3D.

    isOTG()

    Returns

    typedescription
    boolean true if the model is an OTG file - which supports sharing of materials and geometry.

    getData()

    Returns the geometry data.

    getDocumentNode()

    Returns an object wrapping the bubble/manifest entry for the loaded geometry. Contains data such as the viewableID, guid, role…

    Returns

    getRoot()

    Returns the root of the geometry node graph.

    Returns

    typedescription
    object The root of the geometry node graph. Null if it doesn’t exist.

    getRootId()

    Returns the root of the geometry node graph.

    Returns

    typedescription
    number The ID of the root or null if it doesn’t exist.

    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
    * Required

    Returns

    typedescription
    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

    typedescription
    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

    typedescription
    string Standard representation of model’s unit distance or null if it is not known.

    getDisplayUnit()

    Returns a standard string representation of the model’s display unit.

    Returns

    typedescription
    string Standard representation of model’s display unit or null if it is not known.

    getMetadata(itemName, subitemName, defaultValue)

    Return metadata value.

    Parameters

    itemName*
    string
    Metadata item name.
    subitemName
    string
    Metadata subitem name.
    defaultValue
    Default value.
    * Required

    Returns

    typedescription
    Metadata value, or defaultValue if no metadata or metadata item/subitem does not exist.

    getDefaultCamera()

    Returns the default camera.

    isAEC()

    Returns

    typedescription
    boolean true when the "AEC" loader settings were used when loading the model

    getUpVector()

    Returns up vector as an array of 3.

    geomPolyCount()

    Returns the polygon count.

    Returns

    typedescription
    number

    instancePolyCount()

    Returns the instanced polygon count.

    Returns

    typedescription
    number

    isLoadDone()

    Returns true if the model with all its geometries has loaded.

    Returns

    typedescription
    boolean

    isObjectTreeCreated()

    Returns true if the frag to node id mapping is done.

    Returns

    typedescription
    boolean

    getPropertyDb()

    Returns an instance of PropertyDatabase Loader, responsible for communicating with the PropertyDatabase instance hosted in a browser worker thread.

    Returns

    typedescription
    PropDbLoader

    getProperties(dbId, onSuccessCallback, onErrorCallback)

    Asyncronous method that gets object properties

    Parameters

    dbId*
    number
    The database identifier.
    onSuccessCallback
    Callbacks#onPropertiesSuccess
    Callback for when the properties are fetched.
    onErrorCallback
    Callbacks#onGenericError
    Callback for when the properties are not found or another error occurs.
    * Required

    getBulkProperties(dbIds, options, onSuccessCallback, onErrorCallback)

    Returns properties for multiple objects with an optional filter on which properties to retrieve.

    Parameters

    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.
    * Required

    getLayerToNodeIdMapping(onSuccessCallback, onErrorCallback)

    Returns an object with key values being layer names, pointing to Arrays containing dbIds.

    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.
    * Required

    getObjectTree(onSuccessCallback, onErrorCallback)

    Asyncronous operation that gets a reference to the object tree.

    You can use the model object tree to get information about items in the model. The tree is made up of nodes, which correspond to model components such as assemblies or parts.

    Parameters

    onSuccessCallback
    Callbacks#onObjectTreeSuccess
    Success callback invoked once the object tree is available.
    onErrorCallback
    Callbacks#onGenericError
    Error callback invoked when the object tree is not found available.

    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.

    Returns

    typedescription
    boolean

    search(text, onSuccessCallback, onErrorCallback, attributeNames)

    Async operation to search the object property database.

    Parameters

    text*
    string
    The search term (not case sensitive).
    onSuccessCallback*
    Callbacks#onSearchSuccess
    Invoked when the search results are ready.
    onErrorCallback*
    Callbacks#onGenericError
    Invoke when an error occured during search.
    attributeNames
    Array.<string>
    Restricts search to specific attribute names.
    * Required

    findProperty(propertyName)

    Searches the property database for all dbIds that contains a specific property name.

    Parameters

    propertyName*
    string
    The property name to search for (case sensitive).
    * Required

    Returns

    typedescription
    Promise that resolves with an Array of dbIds containing the specified property.

    getTopology(index)

    Return topology data of one fragment.

    Requires topology data to have been fetched with [fetchTopology()]`Autodesk.Viewing.Model#fetchTopology </en/docs/viewer/v6/reference/Viewing/Model/#fetchTopology/>`_.

    Parameters

    index*
    number
    Topology index.
    * Required

    Returns

    typedescription
    object Topology data.

    hasTopology()

    See also [fetchTopology()]`Autodesk.Viewing.Model#fetchTopology </en/docs/viewer/v6/reference/Viewing/Model/#fetchTopology/>`_.

    Returns

    typedescription
    boolean true if topology data has been downloaded and is available in memory

    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

    typedescription
    Promise that resolves with the topology object.

    hasGeometry()

    Returns

    typedescription
    boolean true if the model loaded contains at least 1 fragment.