Request

Response

    Autodesk.Viewing

    GuiViewer3D

    new GuiViewer3D(container, config)

    Viewer component based on Autodesk.Viewing.Viewer3D with added UI.

    Parameters

    container*
    HTMLElement
    The viewer container.
    config*
    object
    The initial settings object. See base class for details.
    * Required

    Methods

    loadExtension(extensionId, options)

    Loads the extension with the given id and options. For internal use only.

    Parameters

    extensionId*
    string
    The string id of the extension.
    options*
    Object
    An optional dictionary of options.
    * Required

    Returns

    typedescription
    Promise Resolves with the extension requested.

    getExtension(extensionId)

    Returns the loaded extension.

    Parameters

    extensionId*
    string
    The string id of the extension.
    * Required

    Returns

    typedescription
    Object Extension.

    unloadExtension(extensionId)

    Unloads the extension with the given id. For internal use only.

    Parameters

    extensionId*
    string
    The string id of the extension.
    * Required

    Returns

    typedescription
    boolean True if the extension was successfully unloaded.

    loadExtensionLocal(extensionId, options)

    Loads the extension with the given id and options. For internal use only.

    Available from version 2.15

    Parameters

    extensionId*
    string
    The string id of the extension.
    options*
    Object
    An optional dictionary of options.
    * Required

    Returns

    typedescription
    Promise Resolves with the extension requested.

    loadExtensionAsync(extensionId, url, options)

    Loads an extension JavaScript file from a URL. It will download the file, parse it and then invoke loadExtension(). Calling this function a second time will not download the file again.

    Available from version 2.15

    Parameters

    extensionId*
    string
    The string id of the extension.
    url*
    string
    The url where the extension’s JavaScript file is hosted. Can be a relative or absolute path.
    options*
    Object
    An optional dictionary of options, same as in loadExtension().
    * Required

    Returns

    typedescription
    promise That resolves with the extension object.

    Examples

    viewer.loadExtensionAsync(
           'MyExtensionId',
           'http://my.site.com/path/MyExtension.js',
           {}
       ).then(function(ext){
           ext.doSomething();
       }).catch(function(error){
           console.error(error);
       });
    
    Show More

    start(url, options, onSuccessCallback, onErrorCallback)

    Initializes the viewer and loads any extensions specified in the constructor’s config parameter. If the optional parameters are specified, the start() function will use an optimized initialization sequence that results in faster model load. The parameters are the same as the ones for Viewer3D.loadModel and you do not need to call loadModel subsequently if the model is loaded via the call to start().

    Parameters

    url
    string
    Optional URN or filepath to load on start.
    options
    string
    Optional path to shared property database.
    onSuccessCallback
    Autodesk.Viewing.Viewer3D~onLoadModelSuccess
    Method that gets called when initial loading is doneand streaming starts.
    onErrorCallback
    Autodesk.Viewing.Viewer3D~onLoadModelFailure
    Method that gets called when initial loading ends with an error.

    Returns

    typedescription
    number 0 if the viewer has started, an error code (same as that returned by initialize()) otherwise.

    setUp(config)

    Loading extensions and initializing canvas interactions. Invoked automatically by Autodesk.Viewing.Viewer3D#start method.

    Parameters

    config*
    ViewerConfig
    configuration values
    * Required

    tearDown()

    Unloads extensions and the model loaded. Invoked automatically by Autodesk.Viewing.Viewer3D#finish method.

    run()

    Triggers the Viewer’s render loop. Invoked automatically by Autodesk.Viewing.Viewer3D#start method. Refer to [ViewerConfig.startOnInitialize]`ViewerConfig <#fixMe/>`_ to change start’s method behavior.

    localize()

    Localize the viewer. This method can be overwritten so that the subclasses can localize any additional elements. Invoked internally during initialization.

    uninitialize()

    Removes all created DOM elements and performs any GL uninitialization that is needed.

    finish()

    Unloads any loaded extensions and then uninitializes the viewer.

    loadModel(url, options, onSuccessCallback, onErrorCallback)

    Loads a model into the viewer. Can be used sequentially to load multiple 3D models into the same scene.

    Parameters

    Expand all
    url*
    string
    The url to the model.
    options
    object
    Dictionary of options.
    fileLoader
    Autodesk.Viewing.FileLoader
    The file loader to use for this url. Required for unsupported file types.
    loadOptions
    object
    May contain params that are specific for certain loaders/filetypes.
    sharedPropertyDbPath
    string
    Optional path to shared property database.
    ids
    string
    A list of object IDs to load.
    loadAsHidden
    bool
    By default, a new model is instantly shown and triggers viewer refreshes during loading. Setting this option avoids that. The model can then be shown later by calling showModel().
    modelNameOverride
    string
    Allows host application to override model name used in UI.
    onSuccessCallback
    Autodesk.Viewing.Viewer3D~onLoadModelSuccess
    A method that gets called when model’s metadata loading is doneand geometry streaming starts.
    onErrorCallback
    Autodesk.Viewing.Viewer3D~onLoadModelFailure
    A method that gets called when loading fails.
    * Required

    loadDocumentNode(avDocument, manifestNode, options)

    Parameters

    avDocument*
    Autodesk.Viewing.Document
    The Document instance, which owns the model being loaded
    manifestNode*
    Autodesk.Viewing.BubbleNode
    The specific manifest node to load (within the Document)
    options
    ViewerConfig
    Options to pass to {@link Autodesk.Viewing.Viewer3D#loadModel}. Will be initialized internally if not specified. The options object will be augmented by automatically determined load parameters.
    * Required

    getDimensions()

    Returns the dimensions of the WebGL canvas.

    Returns

    typedescription
    object Client rectangle bounds object { width:Number, height: Number }

    resize()

    Resizes the viewer. Required when wrapping div changes dimensions due to CSS changes.

    getHotkeyManager()

    Returns

    typedescription
    Autodesk.Viewing.HotkeyManager The hotkey manager.

    getCamera()

    Gets the camera so it can be modified by the client.

    Returns

    typedescription
    THREE.Camera The active camera.

    getState(filter)

    Gets the view state as a plain object. A viewer state contains data for the viewport, selection and isolation,

    Parameters

    filter
    object
    Specifies which viewer values to get.

    Returns

    typedescription
    object Viewer state.

    restoreState(viewerState, filter, immediate)

    Restores the viewer state from a given object.

    Parameters

    viewerState*
    Object
    filter
    Object
    Similar in structure to viewerState used to filter out valuesthat should not be restored.
    immediate
    boolean
    Whether the new view is applied with (true) or without transition (false).
    * Required

    Returns

    typedescription
    boolean True if restore operation was successful.

    setViewFromViewBox(viewbox, name, skipTransition)

    Sets the view from an array representing a view box.

    Not applicable to 3D.

    Parameters

    viewbox*
    Array.<Number>
    View parameters:min-xmin-ymax-xmax-y
    name
    string
    Optional named view name to also set the layer visibility stateassociated with this view.
    skipTransition
    boolean
    true to apply instanstly instead of lerping.
    * Required

    activateLayerState(stateName)

    Changes the active layer state. Layes is a feature usually available on 2D models and some 3D models.

    Parameters

    stateName*
    string
    Name of the layer state to activate.
    * Required

    getLayerStates()

    Returns information for each layer state: name, description, active. Activate a state through Autodesk.Viewing.Viewer3D#activateLayerState.

    Returns

    typedescription
    array

    setViewFromFile(model)

    Sets the view using the default view in the source file.

    Parameters

    model
    Autodesk.Viewing.Model
    The model, defaults to the loaded model.

    getProperties(dbid, onSuccessCallback, onErrorCallback)

    Gets the properties for an ID.

    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

    getObjectTree(onSuccessCallback, onErrorCallback)

    Gets the viewer model object tree. Once the tree is received it will invoke the specified callback function.

    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.

    setCanvasClickBehavior(config)

    Sets the click behavior on the canvas to follow config. This is used to change the behavior of events such as selection or COI changed.

    Parameters

    config*
    object
    Parameter object that meets the above layout.
    * Required

    Examples

     {
         "click": {
             "onObject": [ACTIONS],
             "offObject": [ACTIONS]
         },
         "clickCtrl": {
             "onObject": [ACTIONS],
             "offObject": [ACTIONS]
         },
         "clickShift": {
             ...
         },
         "clickCtrlShift": {
             ...
         },
         "disableSpinner": BOOLEAN
         "disableMouseWheel": BOOLEAN,
         "disableTwoFingerSwipe": BOOLEAN
    }
    
    Show More

    Actions can be any of the following: - “selectOnly” - “selectToggle” - “deselectAll” - “isolate” - “showAll” - “setCOI” - “focus” - “hide”


    search(text, onSuccessCallback, onErrorCallback, attributeNames)

    Searches the elements for the given text. When the search is complete, the callback onResultsReturned(idArray) is invoked.

    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

    getHiddenNodes()

    Returns an array of the IDs of the currently hidden nodes. When isolation is in place, there are no hidden nodes returned because all nodes that are not isolated are considered hidden.

    Returns

    typedescription
    Array.<number> Array of nodes that are currently hidden, when no isolation is in place.

    getIsolatedNodes()

    Returns an array of the IDs of the currently isolated nodes.

    Not yet implemented for 2D.

    Returns

    typedescription
    Array.<number> Array of nodes that are currently isolated.

    isolate(node, model)

    Isolates one of many sub-elements. You can pass in a node or an array of nodes to isolate. Pass in null to reset isolation.

    Parameters

    node*
    Array.<number>, number
    A node ID or array of node IDs from the model tree {@link BaseViewer#getObjectTree}.
    model
    Autodesk.Viewing.Model
    the model that contains the node id. Defaults to the first loaded model.
    * Required

    setBackgroundColor(red, green, blue, red2, green2, blue2)

    Sets the background colors, which will be used to create a gradient. Values are in the range [0..255]

    Parameters

    red*
    number
    green*
    number
    blue*
    number
    red2*
    number
    green2*
    number
    blue2*
    number
    * Required

    toggleSelect(dbid, model, selectionType)

    Toggles the selection for a given dbid. If it was unselected, it is selected. If it was selected, it is unselected.

    Currently three ways of node selection are supported:

    Autodesk.Viewing.SelectionMode.MIXED Leaf nodes are selected using the overlayed selection type, and inner nodes are selected using regular selection type.

    Autodesk.Viewing.SelectionMode.REGULAR Nodes are tinted with the selection color.

    Autodesk.Viewing.SelectionMode.OVERLAYED Nodes are tinted with the selection color and shown on top of the not selected geometry.

    Not yet implemented for 2D.

    Parameters

    dbid*
    number
    model
    Autodesk.Viewing.Model
    the model that contains the dbId. Uses the initial model loaded by default.
    selectionType*
    number
    a member of Autodesk.Viewing.SelectionMode.
    * Required

    select(dbids, model, selectionType)

    Selects the array of ids. You can also just pass in a single id instead of an array.

    Currently three ways of node selection are supported:

    Autodesk.Viewing.SelectionMode.MIXED Leaf nodes are selected using the overlayed selection type, and inner nodes are selected using regular selection type.

    Autodesk.Viewing.SelectionMode.REGULAR Nodes are tinted with the selection color.

    Autodesk.Viewing.SelectionMode.OVERLAYED Nodes are tinted with the selection color and shown on top of the not selected geometry.

    Parameters

    dbids*
    Array.<number>, number
    element or array of elements to select.
    model
    Autodesk.Viewing.Model
    the model instance containing the ids.
    selectionType*
    number
    a member of Autodesk.Viewing.SelectionMode.
    * Required

    clearSelection()

    Clears the selection.

    getSelectionVisibility()

    Returns information about the visibility of the current selection.

    Returns

    typedescription
    object {hasVisible:boolean, hasHidden:boolean}

    getSelectionCount()

    Returns the number of nodes in the current selection.

    Returns

    typedescription
    number

    setSelectionMode(mode)

    Sets selection granularity mode. Supported values are:

    Autodesk.Viewing.SelectionMode.LEAF_OBJECT Always select the leaf objects in the hierarchy.

    Autodesk.Viewing.SelectionMode.FIRST_OBJECT For a given node, selects the first non-composite (layer, collection, model) on the path from the root to the given node, and all children.

    Autodesk.Viewing.SelectionMode.LAST_OBJECT For a given node, selects the nearest ancestor composite node and all children. Selects the input node itself in case there is no composite node in the path to the root node.

    Parameters

    mode*
    number
    The selection mode.
    * Required

    getSelection()

    Returns the current selection.

    Returns

    typedescription
    Array.<number> Array of the IDs of the currently selected nodes.

    getAggregateSelection(callback)

    Returns the selected items from all loaded models.

    Parameters

    callback
    function
    Optional callback to receive enumerated pairs of model and dbIdfor each selected object. If no callback is given, an array of objects is returned.

    Returns

    typedescription
    Array.<object> An array of objects with a model and selectionSet properties for each modelthat has selected items in the scene.

    getAggregateIsolation()

    Returns the isolated items from all loaded models.

    Returns

    typedescription
    Array.<object> An array of objects with a model and the isolated ids in that model.

    getAggregateHiddenNodes()

    Returns the hidden nodes for all loaded models.

    Returns

    typedescription
    Array.<object> An array of objects with a model and the hidden ids in that model.

    hide(node, model)

    Ensures the passed in dbid / ids are hidden.

    Parameters

    node*
    Array.<number>, number
    An array of dbids or just an id
    model
    Autodesk.Viewing.Model
    The model that contains the dbId. By default uses the initial model loaded into the scene.
    * Required

    show(node, model)

    Ensures the passed in dbid / ids are shown.

    Parameters

    node*
    Array.<number>, number
    model
    Autodesk.Viewing.Model
    The model that contains the dbId. By default uses the initial model loaded into the scene.
    * Required

    showAll()

    Ensures everything is visible. Clears all node isolation (3D) and turns on all layers (2D).

    toggleVisibility(dbId, model)

    Toggles the visibility of the given node.

    Not yet implemented for 2D.

    Parameters

    dbId*
    number
    the object’s identifier.
    model
    Autodesk.Viewing.Model
    the model that contains the dbId. By default uses the initial model loaded into the scene.
    * Required

    areAllVisible()

    Returns true if every node is visible.

    Returns

    typedescription
    boolean

    isNodeVisible(nodeId, model)

    Returns true if the specified node is visible. The model argument is required only when in multi-model scenarios.

    Parameters

    nodeId*
    number
    Geometry node to check if visible.
    model
    Autodesk.Viewing.Model
    The model that contains the specified nodeId.
    * Required

    Returns

    typedescription
    boolean

    explode(scale)

    Explodes the model from the center of gravity.

    Not applicable to 2D.

    Parameters

    scale*
    number
    A value from 0.0-1.0 to indicate how much to explode.
    * Required

    getExplodeScale()

    Returns the explode scale.

    Not applicable to 2D.

    Returns

    typedescription
    number A value from 0.0-1.0 indicating how exploded the model is.

    setQualityLevel(useSAO, useFXAA)

    Enables or disables the high quality rendering settings.

    Not applicable to 2D.

    Parameters

    useSAO*
    boolean
    True or false to enable screen space ambient occlusion.
    useFXAA*
    boolean
    True or false to enable fast approximate anti-aliasing.
    * Required

    setGhosting(value)

    Toggles ghosting during search and isolate.

    Not applicable to 2D.

    Parameters

    value*
    boolean
    Indicates whether ghosting is on or off.
    * Required

    setGroundShadow(value)

    Toggles ground shadow.

    Not applicable to 2D.

    Parameters

    value*
    boolean
    Indicates whether shadow is on or off.
    * Required

    setGroundReflection(value)

    Toggles ground reflection.

    Not applicable to 2D.

    Parameters

    value*
    boolean
    Indicates whether reflection is on or off.
    * Required

    setEnvMapBackground(value)

    Toggles environment map for background.

    Not applicable to 2D.

    Parameters

    value*
    boolean
    Indicates whether environment map for background is on or off.
    * Required

    setProgressiveRendering(value)

    Toggles whether progressive rendering is used. Warning: turning progressive rendering off will have serious performance implications.

    Parameters

    value*
    boolean
    whether it is on or off
    * Required

    setGrayscale(value)

    Overrlides line colors in 2D models to render in shades of gray. Applies only to 2D models.

    Parameters

    value*
    boolean
    * Required

    setSwapBlackAndWhite(value)

    AutoCAD drawings are commonly displayed with white lines on a black background. Setting reverse swaps (just) these two colors.

    Parameters

    value*
    boolean
    whether it is on or off
    * Required

    setOptimizeNavigation(value)

    Toggles whether the navigation should be optimized for performance. If set to true, anti-aliasing and ambient shadows will be off while navigating.

    Not applicable to 2D.

    Parameters

    value*
    boolean
    whether it is on or off
    * Required

    setNavigationLock(value)

    Locks or unlocks navigation controls.

    When navigation is locked, certain operations (for example, orbit, pan, or fit-to-view) are disabled.

    Parameters

    value*
    boolean
    True if the navigation should be locked.
    * Required

    getNavigationLock()

    Gets the current state of the navigation lock.

    Returns

    typedescription
    boolean True if the navigation controls are currently locked.

    setNavigationLockSettings(settings)

    Updates the configuration of the navigation lock, i.e., which actions are available when navigation is locked.

    The configurable actions are ‘orbit’, ‘pan’, ‘zoom’, ‘roll’, ‘fov’, ‘walk’, or ‘gotoview’. By default, none of the actions are enabled when the navigation is locked.

    Parameters

    settings*
    object
    Map of : pairs specifyingwhether the given action is enabled even when the navigation is locked.
    * Required

    getNavigationLockSettings()

    Gets the current configuration of the navigation lock.

    Returns

    typedescription
    object Map of : pairs specifyingwhether the given action is enabled even when the navigation is locked.

    setActiveNavigationTool(toolName)

    Swaps the current navigation tool for the tool with the provided name. Will trigger NAVIGATION_MODE_CHANGED event if the mode actually changes.

    Parameters

    toolName
    string
    The name of the tool to activate. By default it will switch to the default tool.

    Returns

    typedescription
    boolean True if the tool was set successfully. False otherwise.

    getActiveNavigationTool()

    Returns the name of the active navigation tool.

    Returns

    typedescription
    string The tool’s name.

    setDefaultNavigationTool(toolName)

    Sets the default navigation tool. This tool will always sit beneath the navigation tool on the tool stack.

    Parameters

    toolName*
    string
    The name of the new default navigation tool.
    * Required

    getDefaultNavigationToolName()

    Returns the default navigation tool

    Returns

    typedescription
    Object The default navigation tool.

    getFOV()

    Gets the current camera vertical field of view.

    Returns

    typedescription
    number the field of view in degrees.

    setFOV(degrees)

    Sets the current cameras vertical field of view.

    Parameters

    degrees*
    number
    Field of view in degrees.
    * Required

    getFocalLength()

    Gets the current camera focal length.

    Returns

    typedescription
    number the focal length in millimetres.

    setFocalLength(mm)

    Sets the current cameras focal length.

    Parameters

    mm*
    number
    Focal length in millimetres
    * Required

    hideLines(hide)

    Hides all lines in the scene.

    Parameters

    hide*
    boolean
    * Required

    hidePoints(hide)

    Hides all points in the scene.

    Parameters

    hide*
    boolean
    * Required

    setDisplayEdges(show)

    Turns edge topology display on/off (where available)

    Parameters

    show*
    boolean
    true to turn edge topology display on, false to turn edge topology display off
    * Required

    applyCamera(camera, fit)

    Parameters

    camera*
    THREE.Camera
    the camera to apply.
    fit
    boolean
    Do a fit to view after transition.
    * Required

    fitToView(objectIds, model, immediate)

    Fits camera to objects by ID. It fits the entire model if no ID is provided. Operation will fit to the model’s bounding box when its object tree is not available.

    Parameters

    objectIds
    Array.<number>, null
    array of Ids to fit into the view. Avoid passing this value to fit the entire model.
    model
    Autodesk.Viewing.Model
    The model containing the objectIds.
    immediate
    boolean
    true to avoid the default transition.

    setClickConfig(what, where, newAction)

    Modifies a click action configuration entry.

    Parameters

    what*
    string
    which click config to modify (one of &quot;click&quot;, &quot;clickAlt&quot;, &quot;clickCtrl&quot;, &quot;clickShift&quot;, &quot;clickCtrlShift&quot;).
    where*
    string
    hit location selector (one of &quot;onObject&quot;, &quot;offObject&quot;).
    newAction*
    Array.<string>
    action list (containing any of &quot;setCOI&quot;, &quot;selectOnly&quot;, &quot;selectToggle&quot;, &quot;deselectAll&quot;, &quot;deselectAll&quot;, &quot;isolate&quot;, &quot;showAll&quot;, &quot;hide&quot;, &quot;focus&quot;).
    * Required

    Returns

    typedescription
    boolean False if specified entry is not found, otherwise true.

    getClickConfig(what, where)

    Fetch a click action configuration entry.

    Parameters

    what*
    string
    which click config to fetch (one of &quot;click&quot;, &quot;clickAlt&quot;, &quot;clickCtrl&quot;, &quot;clickShift&quot;, &quot;clickCtrlShift&quot;).
    where*
    string
    hit location selector (one of &quot;onObject&quot;, &quot;offObject&quot;).
    * Required

    Returns

    typedescription
    array action list for the given entry or null if not found.

    setClickToSetCOI(state, updatePrefs)

    Modify the default click behaviour for the viewer.

    Parameters

    state*
    boolean
    If true the default is to set the center of interest. If false the default is single select.
    updatePrefs
    boolean
    If true, the user preferences will be updated.
    * Required

    setLightPreset(index)

    Sets the Light Presets (Environments) for the Viewer.

    Not applicable to 2D.

    Sets the preference in the UI

    Parameters

    index*
    Number
    where0 Simple Grey1 Sharp Highlights2 Dark Sky3 Grey Room4 Photo Booth5 Tranquility6 Infinity Pool7 Simple White8 Riverbank9 Contrast10 Rim Highlights11 Cool Light12 Warm Light13 Soft Light14 Grid Light15 Plaza16 Snow Field
    * Required

    setUsePivotAlways(value)

    Set or unset a view navigation option which requests that orbit controls always orbit around the currently set pivot point.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true to request use of the pivot point. When false some controls may pivot around the center of the view. (Currently applies only to the view-cube orbit controls.)
    * Required

    setReverseZoomDirection(value)

    Set or unset a view navigation option to reverse the default direction for camera dolly (zoom) operations.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true for reverse, false for default
    * Required

    setReverseHorizontalLookDirection(value)

    Set or unset a view navigation option to reverse the default direction for horizontal look operations.

    Not applicable to 2D.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true for reverse, false for default
    * Required

    setReverseVerticalLookDirection(value)

    Set or unset a view navigation option to reverse the default direction for vertical look operations.

    Not applicable to 2D.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true for reverse, false for default
    * Required

    setZoomTowardsPivot(value)

    Get the state of the view navigation option that requests the default direction for camera dolly (zoom) operations to be towards the camera pivot point.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true for towards the pivot, false for default
    * Required

    setOrbitPastWorldPoles(value)

    Set or unset a view navigation option to allow the orbit controls to move the camera beyond the north and south poles (world up/down direction). In other words, when set the orbit control will allow the camera to rotate into an upside down orientation. When unset orbit navigation should stop when the camera view direction reaches the up/down direction.

    Not applicable to 2D.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true to allow orbiting past the poles.
    * Required

    setUseLeftHandedInput(value)

    Set or unset a view navigation option which requests that mouse buttons be reversed from their default assignment. i.e. Left mouse operation becomes right mouse and vice versa.

    Sets the preference in the UI

    Parameters

    value*
    boolean
    value of the option, true to request reversal of mouse button assignments.
    * Required

    setLayerVisible(nodes, visible, isolate)

    Set visibility for a single layer, or for all layers.

    Parameters

    nodes*
    Array
    An array of layer nodes, or a single layer node, or null for all layers
    visible*
    boolean
    true to show the layer, false to hide it
    isolate
    boolean
    true to isolate the layer
    * Required

    isLayerVisible(node)

    Returns true if the layer is visible.

    Parameters

    node*
    Object
    Layer node
    * Required

    Returns

    typedescription
    boolean true if the layer is visible

    anyLayerHidden()

    Returns true if any layer is hidden.

    Returns

    typedescription
    boolean true if any layer is hidden

    allLayersHidden()

    Returns true if all layers are hiden.

    Returns

    typedescription
    boolean true if all layers are hidden

    setGroundShadowColor(color)

    If enabled, set ground shadow color

    Not applicable to 2D

    Parameters

    color*
    THREE.Color
    * Required

    setGroundShadowAlpha(alpha)

    If enabled, set ground shadow alpha

    Not applicable to 2D

    Parameters

    alpha*
    float
    * Required

    setGroundReflectionColor(color)

    If enabled, set ground reflection color. This is reset to default when reflections toggled off.

    Not applicable to 2D

    Parameters

    color*
    THREE.Color
    * Required

    setGroundReflectionAlpha(alpha)

    If enabled, set ground reflection alpha. This is reset to default when reflections toggled off.

    Not applicable to 2D

    Parameters

    alpha*
    float
    * Required

    getCutPlanes()

    Returns a list of active cut planes

    Not applicable to 2D

    Returns

    typedescription
    Array.<THREE.Vector4> List of Vector4 plane representation {x:a, y:b, z:c, w:d}

    setCutPlanes(planes)

    Apply a list of cut planes

    Not applicable to 2D

    Parameters

    planes*
    Array.<THREE.Vector4>
    List of Vector4 plane representation: {x:a, y:b, z:c, w:d}Plane general equation: ax + by + cz + d = 0 where a, b, and c are not all zeroPassing an empty list or null is equivalent to setting zero cut planes
    * Required

    getScreenShot(w, h, cb, overlayRenderer)

    Captures the current screen image as Blob URL Blob URL can be used like a regular image url (e.g., window.open, img.src, etc) If width and height are 0, returns asynchronously and calls the callback with an image as Blob URL with dimensions equal to current canvas dimensions If width and height are given, returns asynchronously and calls the callback with the resized image as Blob URL If no callback is given, displays the image in a new window. Optional overlayRenderer can be supplied, in order to render an overlay on top of the renderer image.

    Parameters

    w
    number
    width of the requested image
    h
    number
    height of the requested image
    cb
    function
    callback
    overlayRenderer
    function
    overlayRenderer

    Returns

    typedescription
    DOMString screenshot image Blob URL, if no parameters are given

    worldToClient(point, camera)

    Calculates the pixel position in client space coordinates of a point in world space.

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

    Parameters

    point*
    THREE.Vector3
    Point in world space coordinates.
    camera*
    THREE.Camera
    Optional camera to use - default is the viewer’s native camera.
    * Required

    Returns

    typedescription
    THREE.Vector3 Point transformed and projected into client space coordinates. Z value is 0.

    clientToWorld(clientX, clientY, ignoreTransparent)

    Given coordinates in pixel screen space it returns information of the underlying geometry node. Hidden nodes will not be taken into account. Returns null if there is no geometry in the specified location. For 2d models, it will return null outside the paper.

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

    Parameters

    clientX*
    Number
    X coordinate where 0 is left
    clientY*
    Number
    Y coordinate where 0 is top
    ignoreTransparent
    Boolean
    Ignores transparent materials
    * Required

    Returns

    modelHasTopology()

    Expose if the model has topology information downloaded. Only applicable to 3D models.

    Returns

    typedescription
    boolean value - Indicates whether the model has topology information.

    setSelectionColor(color, selectionType)

    Changes the color of the selection for a particular selection type.

    Autodesk.Viewing.SelectionMode.MIXED Sets the same color for regular and overlayed selection.

    Autodesk.Viewing.SelectionMode.REGULAR Sets the color of regular selection.

    Autodesk.Viewing.SelectionMode.OVERLAYED Sets the color of overlayed selection.

    Parameters

    color*
    THREE.Color
    selectionType*
    number
    a member of Autodesk.Viewing.SelectionMode.
    * Required

    Examples

    viewer.setSelectionColor(new THREE.Color(0xFF0000), Autodesk.Viewing.SelectionMode.MIXED); // red color
    

    set2dSelectionColor(color)

    Changes the color of the selection for 2D drawings.

    Parameters

    color*
    THREE.Color
    * Required

    Examples

    viewer.set2dSelectionColor(new THREE.Color(0xFF0000)); // red color
    

    getToolbarPromise()

    Interface method for UI workflows, returns a Promise that is meant to resolve with the instance of the toolbar. Headless Viewer will always return a rejected Promise.

    Returns

    typedescription
    Promise

    displayViewCube(display)

    Display ViewCube.

    Parameters

    display*
    boolean
    Display or hide the ViewCube.
    * Required

    displayViewCubeUI(display)

    Display ViewCube UI, the buttons around it.

    Parameters

    display*
    boolean
    Display or hide the ViewCube with home and info buttons.
    * Required

    setViewCube(face)

    Set the face of ViewCube and apply camera transformation according to it.

    Parameters

    face*
    string
    The face name of ViewCube. The name can contain multiple face names,the format should be &quot;[front/back], [top/bottom], [left/right]&quot;.
    * Required

    setTheme(name)

    Sets the current UI theme of the viewer. Supported values are &quot;light-theme&quot; and &quot;dark-theme&quot;, which is the default.

    Parameters

    name*
    string
    Name of the theme, it will be added to the viewer’s container class list.
    * Required

    setThemingColor(dbId, color, model, recursive)

    Highlight an object with a theming color that is blended with the original object’s material.

    Parameters

    dbId*
    number
    color*
    THREE.Vector4
    (r, g, b, intensity), all in [0,1].
    model
    Autodesk.Viewing.Model
    For multi-model support.
    recursive
    boolean
    Should apply theming color recursively to all child nodes.
    * Required

    clearThemingColors(model)

    Restore original colors for all themed shapes.

    Parameters

    model
    Autodesk.Viewing.Model
    For multi-model support.

    hideModel(modelId)

    Temporarily remove a model from the Viewer, but keep loaders, materials, and geometry alive.

    Parameters

    modelId*
    * Required

    Returns

    typedescription
    boolean true indicates success, i.e., modelId referred to a visible model that is now hidden

    showModel(modelId, preserveTools)

    Make a previously hidden model visible again.

    Parameters

    modelId*
    preserveTools*
    bool
    disable automatic activation of default tool
    * Required

    Returns

    typedescription
    boolean true indicates success, i.e., modelId referred to a hidden model that is now visible

    getVisibleModels()

    Returns

    typedescription
    Array.<Autodesk.Viewing.Model>

    getHiddenModels()

    Returns

    typedescription
    Array.<Autodesk.Viewing.Model>

    disableHighlight()

    Disables roll-over highlighting.

    disableSelection(disable)

    disable the selection of a loaded model.

    Parameters

    disable*
    boolean
    true to disable selection, false to enable selection.
    * Required

    isHighlightDisabled()

    check if the mouse-over highlight is disabled or not

    isHighlightPaused()

    check if the mouse-over highlight is paused or not

    isHighlightActive()

    check if the mouse-over highlight is active or not

    isSelectionDisabled()

    check if the selection of the loaded model is disabled or not

    activateExtension(extensionID, mode)

    Activates the extension based on the extensionID and mode given. By default it takes the first available mode in getmodes();

    Parameters

    extensionID*
    string
    The extension id.
    mode
    string
    * Required

    deactivateExtension(extensionID)

    Dectivates the extension based on the extensionID specified.

    Parameters

    extensionID*
    string
    * Required

    isExtensionActive(extensionID, mode)

    Check if the extension is active or not by passing the extensionID.

    Parameters

    extensionID*
    string
    mode*
    string
    * Required

    isExtensionLoaded(extensionID)

    Check if the extension is loaded or not by passing the extensionID.

    Parameters

    extensionID*
    string
    * Required

    getLoadedExtensions()

    Get a list of all the extensions that are currently loaded.

    Returns

    typedescription
    Array.<string>

    getExtensionModes(extensionID)

    Get a list of all the modes that are available for the given extensionID.

    Parameters

    extensionID*
    string
    * Required