Request

Response

    Autodesk
    Version 8 preview
    This page documents a preview of the Viewer SDK v8. APIs and content can still change before the final release.

    Viewing

    Viewing is the top-level namespace in the Viewer SDK library. Use these classes to implement basic viewer functionality.

    There are many classes in the Viewing namespace. Depending on what you’re doing, you won’t need to use most of them. Here are a few essential methods and classes to get started using Viewer SDK.

    • Initializer: Use this method to initialize the viewer environment and runtime. You’ll need to initialize the viewer before loading models into the viewer.
    • Viewer3D: Use Viewer3D to connect to Autodesk Platform Services and display 2D and 3D models in a headless viewer object.
    • GUIViewer3D: Use GUI Viewer3D instead of Viewer3D to create a viewer object with UI elements, including a toolbar.
    • ToolController: Use ToolController if you plan to build your own tools in the viewer.

    Check out this tutorial to learn more:

    Getting Started

    Methods

    Initializer(options)

    Static method for initializing the viewer runtime. Models must be loaded after this step is completed.

    Includes:

    • End points of cloud services the viewer uses, like Model Derivative
    • Authentication and authorization cookie settings on the client side
    • Misc runtime environment variables and global viewer configurations parameters

    Parameters

    Expand all
    options*
    object
    The options object contains configuration parameters used to do initializations. If no access token or authentication callback is provided, the Initializer will fall back on an access token provided in the URL query string, or a previous access token stored in the cookie cache, if available.
    env
    string
    Either AutodeskProduction, AutodeskStaging, or AutodeskDevelopment. Local can be used to avoid attaching authentication headers to XHR requests.
    api
    string
    If automatic routing (the DS_ENDPOINTS feature flag) is enabled, must be streamingV2 for SVF2 or derivativeV2 for SVF. If automatic routing is disabled, must be streamingV2 (SVF2) or derivativeV2 (SVF) for models stored in a US data center, streamingV2_EU (SVF2) or derivativeV2_EU (SVF) for models stored in a European data center, or streamingV2_AUS (SVF2) or derivativeV2_AUS (SVF) for models stored in an Australian data center. Defaults to derivativeV2 if left undefined.
    getAccessToken
    function
    An function that provides an access token asynchronously. The function signature is getAccessToken(onSuccess), where onSuccess is a callback that getAccessToken function should invoke when a token is granted, with the token being the first input parameter for the onSuccess function, and the token expire time (in seconds) being the second input parameter for the function. Viewer relies on both getAccessToken and the expire time to automatically renew token, so it is critical that getAccessToken must be implemented as described here.
    accessToken
    string
    An access token. Not needed when options.getAccessToken is provided.`
    webGLHelpLink
    string
    A link to a help page on webGL if it’s disabled.
    language
    string
    Preferred language code as defined in RFC 4646, such as en, de, fr, etc. If no language is set, viewer will pick it up from the browser. If language is not as defined in RFC, viewer will fall back to “en” (English) but the behavior is undefined.
    lmvResourceRoot
    string
    The root folder that contains LMV resources, will be derived if not specified.
    renderer
    string
    webgpu is used whenever the browser can create a WebGPU device, and falls back to WebGL otherwise. webgl is deprecated, WebGL is only kept as a fallback and may lack newer features.
    * Required

    Returns

    typedescription
    Promise (void) Resolves when initialization is finished. Viewers must only be created after that, e.g., after await Autodesk.Viewing.Initializer(options). Rejects if the page is not running in a secure context, e.g., if it isn’t served via HTTPS or from localhost.

    Examples

     var options = {
       env: "AutodeskProduction",
       language: "en",
       getAccessToken: function(onSuccess) {
           // TODO: Get actual APS token and expiration time.
           var accessToken = 'your_access_token';
           var expirationTimeSeconds = 5 * 60; // 5 minutes
           onSuccess(accessToken, expirationTimeSeconds);
       }
    };
    await Autodesk.Viewing.Initializer(options);
    console.log("initialization complete, creating the viewer...");
    
    Show More

    shutdown()

    Counterpart to Initializer, use it to free up memory. Developers need to uninitialize all Viewer3D instances before invoking this function.

    getParameterByName(name)

    Returns the query parameter value from window url

    Parameters

    name*
    string
    Parameter name
    * Required

    Returns

    typedescription
    string
    • Parameter value

    getParameterByNameFromPath(name, url)

    Parameter from url

    Parameters

    name*
    string
    Parameter name
    url*
    string
    URL
    * Required

    Returns

    typedescription
    string
    • Parameter value

    toUrlSafeBase64(str)

    Convert to url-safe base 64 string

    Parameters

    str*
    string
    String to convert
    * Required

    Returns

    typedescription
    • Url-safe base64 string

    fromUrlSafeBase64(str)

    Decodes a base64 string.

    Parameters

    str*
    string
    String to convert
    * Required

    Returns

    typedescription
    string
    • String after decoding from base64

    tryFromUrlSafeBase64(str)

    Tries to decode a given string. If decoding failed for any reason, the string is returned as is.

    Parameters

    str*
    string
    String to convert
    * Required

    Returns

    typedescription
    string
    • String after decoding from base64 or string as is if decoding was not possible

    GlobalManagerMixin()

    Adds the GlobalManagerProvider methods to the prototype of another class.

    This function can be used to add the GlobalManagerProvider functionality to a class without directly inheriting from the GlobalManagerProvider class. The downside will be that there will not be correct type information for the globalManager property.

    It is mainly provided for backwards compatibility because this pattern is used in all existing extensions. Where possible, prefer to inherit from the GlobalManagerProvider class.

    Constants

    AttributeType

    Numeric values and their meanings associated to PropertyResult.type. They describe how to interpret the property value.

    type

    Object

    Properties

    Unknown
    number
    Unknown type.
    Boolean
    number
    Boolean value.
    Integer
    number
    Integer number.
    Double
    number
    Double precision floating point number.
    Float
    number
    Single precision floating point number.
    BLOB
    number
    Binary data.
    DbKey
    number
    Link to another object in the property database, using its dbId.
    String
    number
    String.
    LocalizableString
    number
    Localizable string.
    DateTime
    number
    ISO 8601 date and time string.
    GeoLocation
    number
    Geolocation as ISO 6709 Annex H string, e.g. "+27.5916+086.5640+8850/" for Mount Everest.
    Position
    number
    Space separated string with 2, 3 or 4 vector components, e.g. "x y z w".

    NODE_TYPE

    Type of an object tree node.

    type

    number

    Properties

    NODE_TYPE_ASSEMBLY
    number
    Real world object as assembly of sub-objects
    NODE_TYPE_INSERT
    number
    Insert of multiple-instanced object
    NODE_TYPE_LAYER
    number
    A layer (specific abstraction collection)
    NODE_TYPE_COLLECTION
    number
    An abstract collection of objects (e.g. “Doors”)
    NODE_TYPE_COMPOSITE
    number
    A real world object whose internal structure is not relevant to end user
    NODE_TYPE_MODEL
    number
    Root of tree representing an entire Model. An aggregate model can contain multiple nested models.
    NODE_TYPE_GEOMETRY
    number
    Leaf geometry node
    NODE_TYPE_BITS
    number
    mask for all bits used by node type

    Prefs3D

    Preference names that can be used to set Preferences These preference names only apply for 3D models.

    type

    Object

    Properties

    VIEW_CUBE
    string
    Sets the visibility of the viewcube.
    VIEW_CUBE_COMPASS
    string
    Sets the visibility of the viewcube compass. The compass will only be displayed if model contains orientation data.
    VIEW_TYPE
    string
    Sets the view to orthographic or perspective.
    ALWAYS_USE_PIVOT
    string
    Orbit controls always orbit around the currently set pivot point.
    ZOOM_TOWARDS_PIVOT
    string
    Default direction for camera dolly (zoom) operations to be towards the camera pivot point.
    SELECTION_SETS_PIVOT
    string
    Sets selection / un-selection action to automatically reset the orbit pivot to be the center of the multiple selection.
    REVERSE_HORIZONTAL_LOOK_DIRECTION
    string
    Sets a view navigation option to reverse the default direction for horizontal look operations.
    REVERSE_VERTICAL_LOOK_DIRECTION
    string
    Sets a view navigation option to reverse the default direction for vertical look operations.
    ORBIT_PAST_WORLD_POLES
    string
    Set a view navigation option to allow the orbit controls to move the camera beyond the north and south poles (world up/down direction).
    CLICK_TO_SET_COI
    string
    Modify the default click behavior for the viewer.
    GHOSTING
    string
    Toggles ghosting during search and isolate.
    AMBIENT_SHADOWS
    string
    Enables or disables ambient shadows.
    ANTIALIASING
    string
    Enables or disables antialiasing.
    GROUND_SHADOW
    string
    Toggles ground shadow.
    POINT_RENDERING
    string
    Hides all points in the scene.
    LINE_RENDERING
    string
    Hides all lines in the scene.
    EDGE_RENDERING
    string
    Turns edge topology display on/off (where available).
    LIGHT_PRESET
    string
    Sets the Light Presets (Environments) for the Viewer.
    ENV_MAP_BACKGROUND
    string
    Toggles environment map for background.
    BIM_WALK_TOOL_POPUP
    string
    Toggles the bimwalk tool popup.
    BIM_WALK_NAVIGATOR_TYPE
    string
    Identifier for the bimWalkNavigatorType preference. This is used to set the BimWalk tool navigator.
    BIM_WALK_GRAVITY
    string
    Identifier for the bimWalkGravity preference. This is used to toggle the BimWalk tool’s gravity.
    DEFAULT_NAVIGATION_TOOL_3D
    string
    identifier for the toolToUse preference. This is used to set which navigation tool will be used.
    SELECTION_MODE
    string
    identifier for the selectionMode preference. This is used to set which selection mode (Leaf, First, Last object) wil be used by the viewer.
    ENABLE_CUSTOM_ORBIT_TOOL_CURSOR
    string
    identifier for whether the OrbitDollyPanTool will customize the cursor visuals.
    EXPLODE_STRATEGY
    string
    Specifies which algorithm is used when exploding the model. Supported values are ‘hierarchy’ (default) and ‘radial’. Other values are treated as ‘radial’.
    FORCE_DOUBLE_SIDED
    string
    Forces the viewer to render materials as double sided. Otherwise it uses the model specified value.
    DISPLAY_SECTION_HATCHES
    string
    Toggles the hatch pattern on section planes. Doesn’t apply to section boxes.
    GPU_MEMORY_LIMIT
    string
    Sets the maximum amount of GPU memory that can be used by the viewer. (WEBGPU only)

    Prefs2D

    Preference names that can be used to set Preferences These preference names only apply for 2D models.

    type

    Object

    Properties

    GRAYSCALE
    string
    Overrides line colors in 2D models to render in shades of gray.
    SWAP_BLACK_AND_WHITE
    string
    Will switch to white lines on a black background.
    SCREEN_SPACE_LINE_WIDTH
    string
    PDF-only: keeps line thickness constant on screen as you zoom (relative widths preserved).
    LOADING_ANIMATION
    string
    Animates lines while 2D models are loading.
    FORCE_PDF_CALIBRATION
    string
    Force PDF calibration before measuring.
    FORCE_LEAFLET_CALIBRATION
    string
    Force Leaflet calibration before measuring.
    DISABLE_PDF_HIGHLIGHT
    string
    Disables highlighting of PDF viewports on mouse hover.
    USE_PDF_VIEWPORT_INFO
    string
    Uses the units and precision of PDF viewports for measurements, also for PDFs that aren’t Smart PDFs.
    VECTOR_VIEWING
    string
    Vector viewing of PDF.

    Prefs

    Preference names that can be used to set Preferences These preference names are shared between both 3D and 2D models.

    type

    Object

    Properties

    PROGRESSIVE_RENDERING
    string
    Toggles whether progressive rendering is used.
    PROGRESSIVE_FPS_TARGET
    string
    Sets the target for number of frames per second when progressive rendering is used.
    OPEN_PROPERTIES_ON_SELECT
    string
    Open property panel when selecting an object. (Only for GuiViewer3D)
    BACKGROUND_COLOR_PRESET
    string
    Sets a color to the background.
    REVERSE_MOUSE_ZOOM_DIR
    string
    Reverse the default direction for camera dolly (zoom) operations.
    LEFT_HANDED_MOUSE_SETUP
    string
    Reverse mouse buttons from their default assignment (i.e. Left mouse operation becomes right mouse and vice versa).
    FUSION_ORBIT
    string
    Sets the orbit to fusion orbit.
    FUSION_ORBIT_CONSTRAINED
    string
    Sets the the orbit to the contrained fusion orbit.
    WHEEL_SETS_PIVOT
    string
    Sets wheel-zoom action to automatically reset the orbit pivot to the location under the cursor.
    RESTORE_SESSION_MEASUREMENTS
    string
    When opening the measure tool restore any existing measurements that where created during the session.
    DISPLAY_UNITS
    string
    Units for quantities displayed in the property panel
    DISPLAY_UNITS_PRECISION
    string
    Precision for quantities displayed in the property panel
    KEY_MAP_CMD
    string
    CMD key mapping to CTRL key in Mac
    ZOOM_DRAG_SPEED
    string
    Sets a sensitivity of mouse movement with the zoom tool
    ZOOM_SCROLL_SPEED
    string
    Sets a sensitivity of the mouse scroll wheel when zooming

    VIEW_TYPES

    View types used for setting the viewType preference.

    type

    Object

    Properties

    DEFAULT
    number
    Sets the default view and enables the view preferences.
    ORTHOGRAPHIC
    number
    Sets the orthographic view and enables the view preferences.
    PERSPECTIVE
    number
    sets the perspective view and enables the view preferences.
    PERSPECTIVE_ORTHO_FACES
    number
    sets the perspective with orthographic faces view and enables the view preferences

    FPS_TARGET_MODES

    FPS target modes used for setting the progressiveFpsTarget preference.

    type

    Object

    Properties

    LOW
    number
    sets the FPS target to 6.
    MODERATE
    number
    sets the FPS target to 15.
    MEDIUM
    number
    sets the FPS target to 30.
    HIGH
    number
    sets the FPS target to 60.

    DefaultSettings

    Default settings of the viewer. For more information about each setting, please reference the Settings.

    type

    Settings

    Properties

    viewCube
    boolean
    Default Value: true. Sets the visibility of the viewcube. Set to false for mobile devices.
    alwaysUsePivot
    boolean
    Default Value: false. Orbit controls always orbit around the currently set pivot point.
    zoomTowardsPivot
    boolean
    Default Value: false. default direction for camera dolly (zoom) operations to be towards the camera pivot point.
    reverseHorizontalLookDirection
    boolean
    Default Value: false. Sets a view navigation option to reverse the default direction for horizontal look operations.
    reverseVerticalLookDirection
    boolean
    Default Value: false. Sets a view navigation option to reverse the default direction for vertical look operations.
    orbitPastWorldPoles
    boolean
    Default Value: true. Set a view navigation option to allow the orbit controls to move the camera beyond the north and south poles (world up/down direction).
    clickToSetCOI
    boolean
    Default Value: false. Modify the default click behavior for the viewer.
    ghosting
    boolean
    Default Value: true. Toggles ghosting during search and isolate.
    optimizeNavigation
    boolean
    Default Value: false. Toggles whether the navigation should be optimized for performance. Set to true for mobile devices.
    ambientShadows
    boolean
    Default Value: true. Enables or disables ambient shadows.
    antialiasing
    boolean
    Default Value: true. Enables or disables antialiasing. Set to false for mobile devices.
    groundShadow
    boolean
    Default Value: true. Toggles ground shadow.
    groundReflection
    boolean
    Default Value: false. Toggles ground reflection.
    lineRendering
    boolean
    Default Value: true. Hides all lines in the scene.
    edgeRendering
    boolean
    Default Value: false. Turns edge topology display on/off (where available).
    lightPreset
    number
    Default Value: 1. Sets the Light Presets (Environments) for the Viewer.
    envMapBackground
    boolean
    Default Value: false. Toggles environment map for background.
    bimWalkToolPopup
    boolean
    Default Value: true. Toggles the bimwalk tool popup.
    grayscale
    boolean
    Default Value: false. Overrides line colors in 2D models to render in shades of gray.
    swapBlackAndWhite
    boolean
    Default Value: false. Will switch to white lines on a black background for 2D models.
    progressiveRendering
    boolean
    Default Value: true. Toggles whether progressive rendering is used.
    openPropertiesOnSelect
    boolean
    Default Value: false. Open property panel when selecting an object (Only for GuiViewer3D).
    pointRendering
    boolean
    Default Value: true. Hides all points in the scene.
    backgroundColorPreset
    Default Value: null. Sets a color to the background.
    reverseMouseZoomDir
    boolean
    Default Value: false. Reverse the default direction for camera dolly (zoom) operations.
    leftHandedMouseSetup
    boolean
    Default Value: false. Reverse mouse buttons from their default assignment (i.e. Left mouse operation becomes right mouse and vice versa).
    fusionOrbit
    boolean
    Default Value: true. Sets the orbit to fusion orbit.
    fusionOrbitConstrained
    boolean
    Default Value: true. Sets the the orbit to the contrained fusion orbit.
    wheelSetsPivot
    boolean
    Default Value: false. Sets wheel-zoom action to automatically reset the orbit pivot to the location under the cursor.
    selectionSetsPivot
    boolean
    Default Value: false. Sets selection / un-selection action to automatically reset the orbit pivot to be the center of the multiple selection.
    bimWalkNavigatorType
    string
    Default Value: ‘default’. Sets the BimWalk tool navigator.
    defaultNavigationTool3D
    string
    Default Value: ‘default’. Sets which navigation tool will be used by the viewer. (ie: ‘extractor_defined’ || ‘bimwalk’)
    loadingAnimation
    boolean
    Default Value: true. Toggles loading animation for 2D Models.
    zoomDragSpeed
    number
    Default value: 100. Sets a sensitivity of mouse movement with the zoom tool.
    zoomScrollSpeed
    number
    Default value: 0.6. Sets a sensitivity of the mouse scroll wheel when zooming.

    ScreenMode

    List of available screen modes:

    • kNormal: 0
    • kFullBrowser: 1
    • kFullScreen: 2

    type

    number

    Properties

    kNormal
    number
    normal
    kFullBrowser
    number
    full browser
    kFullScreen
    number
    full screen

    exports.TOOLBAR

    Viewer tools sets.

    These constants are used to define the standard set of tools.

    type

    string

    Events

    ESCAPE_EVENT

    Fired when the ESC key is pressed.

    PROGRESS_UPDATE_EVENT

    Fired repeatedly throughout the process of opening a model/drawing.

    Properties

    percent
    number
    Estimated progress.
    state
    number
    Value from Autodesk.Viewing.ProgressState, providing details on the progress state.
    model
    object
    Model being loaded.
    loaded
    number
    Bytes downloaded so far (only set during ProgressState.DOWNLOADING).
    total
    number
    Total bytes to download, when known (only set during ProgressState.DOWNLOADING).

    FULLSCREEN_MODE_EVENT

    Fired when the screen mode changes.

    Properties

    modeNew screen mode.

    VIEWER_STATE_RESTORED_EVENT

    Fired when the viewer state is restored.

    Properties

    value
    boolean
    Success of the state restoration.

    VIEWER_RESIZE_EVENT

    Fired when the viewer size changes.

    Properties

    width
    number
    New width of the viewer.
    height
    number
    New height of the viewer.

    VIEWER_INITIALIZED

    Fired when the viewer is fully initialized.

    VIEWER_UNINITIALIZED

    Fired when the viewer is fully uninitialized.

    LANGUAGE_CHANGED_EVENT

    Fired when the viewer’s language/locale is changed.

    Properties

    language
    string
    The new language code (e.g., ‘en’, ‘de’, ‘ja’).

    LOADER_LOAD_FILE_EVENT

    Fired when the viewer begins loading a model, before the Model instance gets created.

    Properties

    loader
    object
    Instance of the Loader class

    LOADER_LOAD_ERROR_EVENT

    Fired when an error is detected during a load.

    Properties

    loader
    object
    Instance of the Loader class
    error
    object
    The error reported by the loader.

    LOADER_REPAINT_REQUEST_EVENT

    Fired when a loader thinks its time to repaint the model while loading

    Properties

    loader
    Object
    Instance of the Loader class
    modelLoaded model

    MODEL_ROOT_LOADED_EVENT

    Fired when the viewer receives and parses the initial model manifest.

    Properties

    svf
    object
    Parsed SVF/F2D JSON.
    model
    object
    Model data.

    GEOMETRY_LOADED_EVENT

    Fired when the model/drawing finishes loading.

    Properties

    model
    object
    Model data.

    TEXTURES_LOADED_EVENT

    Fired when the model/drawing textures finish loading.

    Properties

    model
    object
    Model data.

    OBJECT_TREE_CREATED_EVENT

    Fired when the object tree is successfully created.

    Properties

    svf
    object
    Parsed SVF/F2D JSON.
    model
    object
    Model data.

    VIEWPOINT_TREE_UPDATED_EVENT

    Fired when the viewpoint tree is updated. Mainly used for loading a ViewpointTreeRoot from a Packfile (Navisworks).

    Properties

    model
    object
    Model data.

    OBJECT_TREE_UNAVAILABLE_EVENT

    Fired when there’s an error while parsing the object tree.

    Properties

    svf
    object
    Parsed SVF/F2D JSON.
    model
    object
    Model data.

    OBJECT_TREE_LOAD_PROGRESS_EVENT

    Fired when there’s a progress event during propertyDB loading.

    Properties

    svf
    object
    Parsed SVF/F2D JSON.
    model
    object
    Model data.

    MODEL_UNLOADED_EVENT

    Fired when a model is removed from the viewer. Note that this event fires after destructor. If you need to access the model, e.g. via model.getData(), use BEFORE_MODEL_UNLOADED instead.

    Properties

    model
    object
    Model data (after disposing data)

    BEFORE_MODEL_UNLOAD_EVENT

    Fired if a model unload is about to happen, but the model is still fully available.

    Properties

    model
    object
    Model data.

    MODEL_ADDED_EVENT

    Fired when a model is added to model queue so as to be visible.

    Properties

    model
    object
    Model data.

    MODEL_REMOVED_EVENT

    Fired when a model is removed from model queue, i.e. changed to invisible.

    Properties

    model
    object
    Model data.

    BUBBLE_NODES_CHANGED_EVENT

    Fired on the viewer when {@link AggregatedView#setNodes | AggregatedView#setNodes()} changes the set of visible bubble nodes (models added or removed from the aggregated view). Also fired by {@link AggregatedView#hideAll | AggregatedView#hideAll()} with the hidden nodes as removed; a {@link AggregatedView#switchView | switchView()} therefore emits two events (removals first, then additions). Only emitted by Aggregated View, not by {@link Viewer3D#loadDocumentNode | loadDocumentNode} alone.

    For newly added nodes, this may fire before a {@link Model} instance exists.

    Properties

    added
    Array.<Autodesk.Viewing.BubbleNode>
    Bubble nodes newly shown.
    removed
    Array.<Autodesk.Viewing.BubbleNode>
    Bubble nodes newly hidden.

    BUBBLE_NODE_LOAD_SKIPPED_EVENT

    Fired on the viewer when Aggregated View will not show a bubble node that it was asked to show, so no {@link MODEL_ADDED_EVENT} follows for it. It can fire more than once for the same node, for example when an empty model is shown again. Consumers that wait for models of a {@link BUBBLE_NODES_CHANGED_EVENT} batch can stop waiting for this node.

    Properties

    bubbleNodeThe bubble node that will not be shown.
    reason
    string
    'empty-geometry' if the model loaded but has no geometry, or 'load-failed' if loading the model failed.

    MODEL_LAYERS_LOADED_EVENT

    Fired when the layers of the model are successfully loaded.

    Properties

    root
    object
    Model layers root.
    model
    object
    Model data.

    MODEL_TRANSFORM_CHANGED_EVENT

    Fired a when model transform matrix has been changed. This usually happens if either placement or globalOffset has changed for a model.

    Properties

    model
    object
    Model data.
    matrix
    object
    Transform matrix.

    EXTENSION_PRE_LOADED_EVENT

    Fired before a viewer extension is loaded.

    Properties

    extensionId
    string
    Extension identifier.

    EXTENSION_LOADED_EVENT

    Fired when a viewer extension is successfully loaded.

    Properties

    extensionId
    string
    Extension identifier.

    EXTENSION_PRE_UNLOADED_EVENT

    Fired before a viewer extension is unloaded.

    Properties

    extensionId
    string
    Extension identifier.

    EXTENSION_UNLOADED_EVENT

    Fired when a viewer extension is successfully unloaded.

    Properties

    extensionId
    string
    Extension identifier.

    EXTENSION_PRE_ACTIVATED_EVENT

    Fired before a viewer extension is activated.

    Properties

    extensionId
    string
    Extension identifier.
    mode
    string
    Activated mode.

    EXTENSION_ACTIVATED_EVENT

    Fired after a viewer extension is activated.

    Properties

    extensionId
    string
    Extension identifier.
    mode
    string
    Activated mode.

    EXTENSION_PRE_DEACTIVATED_EVENT

    Fired before a viewer extension is deactivated.

    Properties

    extensionId
    string
    Extension identifier.

    EXTENSION_DEACTIVATED_EVENT

    Fired after a viewer extension is deactivated.

    Properties

    extensionId
    string
    Extension identifier.

    SELECTION_CHANGED_EVENT

    Fired when the list of selected objects changes.

    Properties

    fragIdsArray
    Array.<number>
    Fragment IDs of selected objects.
    dbIdArray
    Array.<number>
    dbIDs of selected objects.
    nodeArray
    Array.<number>
    Same as dbIdArray.
    model
    object
    Model data.

    AGGREGATE_SELECTION_CHANGED_EVENT

    Fired when the list of selected objects changes in a multi-model context.

    Properties

    selections
    Array.<object>
    List of objects containing the typical selection properties of {@link SELECTION_CHANGED_EVENT} for each model.

    ISOLATE_EVENT

    Fired when the viewer isolates a set of objects (i.e., makes everything else invisible or ghosted).

    Properties

    nodeIdArray
    Array.<number>
    List of isolated node IDs.
    model
    object
    Model data.

    AGGREGATE_ISOLATION_CHANGED_EVENT

    Fired when the list of isolated objects changes in a multi-model context.

    Properties

    isolation
    Array.<object>
    List of objects containing the typical selection properties of {@link ISOLATE_EVENT} for each model.

    HIDE_EVENT

    Fired when the viewer hides a set of objects.

    Properties

    nodeIdArray
    Array.<number>
    List of hidden node IDs.
    model
    object
    Model data.

    AGGREGATE_HIDDEN_CHANGED_EVENT

    Fired when the list of hidden objects changes in a multi-model context.

    Properties

    hidden
    Array.<object>
    List of objects containing the typical selection properties of {@link HIDE_EVENT} for each model.

    SHOW_EVENT

    Fired when the viewer shows a set of objects.

    Properties

    nodeIdArray
    Array.<number>
    List of shown node IDs.
    model
    object
    Model data.

    SHOW_PROPERTIES_EVENT

    Fired to show the properties of the object.

    Properties

    dbId
    number
    dbId of the object.
    model
    object
    Model data.

    SHOW_ALL_EVENT

    Fired whenever viewer.showAll() is used.

    HIDE_ALL_EVENT

    Fired whenever viewer.hideAll() is used.

    CAMERA_CHANGE_EVENT

    Fired when a camera changes.

    Properties

    cameraAffected camera.

    EXPLODE_CHANGE_EVENT

    Fired whenever the Explode tool is used.

    Properties

    scale
    number
    Scale of the current exploded state.
    options
    object
    Optional values of the current exploded state.

    FIT_TO_VIEW_EVENT

    Fired when a fitToView operation is applied.

    Properties

    immediate
    boolean
    True if the change was immediate.
    nodeIdArray
    Array.<number>
    List of node IDs fitted. Array is empty when fitting to the whole model.
    model
    object
    Model data.

    AGGREGATE_FIT_TO_VIEW_EVENT

    Fired when fitToView operation is applied, supports multi-model contexts.

    Properties

    selection
    Array.<object>
    List of objects each containing a model instance and a selection array of ids.

    CUTPLANES_CHANGE_EVENT

    Fired when the cutting planes change.

    Properties

    planes
    Array.<object>
    List of cutplanes.

    TOOL_CHANGE_EVENT

    Fired when a tool is activated or deactivated.

    Properties

    toolName
    string
    Name of a specific mode of a tool.
    tool
    object
    Tool object.
    active
    boolean
    Current status of the tool.

    RENDER_OPTION_CHANGED_EVENT

    Fired when rendering options change.

    FINAL_FRAME_RENDERED_CHANGED_EVENT

    Fired when the render frame shown by the Viewer is final or complete (it has no more pending geometry or post processing effects which delay incoming frames), or when the Viewer stops showing final frames. The name refers to when the state changes from busy to idle for the renderer, or vice versa. To know when all geometry is fully displayed, also check for GEOMETRY_LOADED_EVENT.

    Properties

    finalFrame
    boolean
    final frame is displayed this tick.

    RENDERING_TICKED_EVENT

    This event is triggered for each tick that performs some form of rendering work, providing information about the frame sequence and rendering completion status.

    Note: A series of intermediate frames is not guaranteed to end with isMainSceneDone = true

    Properties

    value
    object
    Event data object containing frame rendering information.

    RENDER_PRESENTED_EVENT

    Fired when the render has presented to the screen.

    LAYER_VISIBILITY_CHANGED_EVENT

    Fired when visibility of a 2D layer changes.

    PREF_CHANGED_EVENT

    Fired when a user preference property changes.

    Properties

    name
    string
    Property name.
    value
    object
    New property value.

    PREF_RESET_EVENT

    Fired when a user preference property is reset.

    Properties

    name
    string
    Property name.
    value
    object
    New property value.

    RESTORE_DEFAULT_SETTINGS_EVENT

    Fired as a result of invoking viewer.restoreDefaultSettings() to restore default settings. Will get fired after all other Autodesk.Viewing.PREF_CHANGED_EVENT get fired.

    ANIMATION_READY_EVENT

    Fired when animations are successfully initialized.

    CAMERA_TRANSITION_COMPLETED

    Fired whenever a camera transition is finished, such as Focus, Go to Home View, Restore State, restore Named Views, and others.

    LOAD_MISSING_GEOMETRY

    Fired when something in the view changes that may expose missing geometry.

    Properties

    delay
    boolean
    A flag used to aggregate multiple events during user interactions. Defaults to true.

    GPU_CONTEXT_LOST_EVENT

    Fired when the WebGL context or WebGPU device is lost.

    WEBGL_CONTEXT_LOST_EVENT

    Deprecated. Use GPU_CONTEXT_LOST_EVENT instead.

    WEBGL_CONTEXT_RESTORED_EVENT

    Fired when the WebGLRenderingContext was restored

    CANCEL_LEAFLET_SCREENSHOT

    Fired when a leaflet screenshot needs to be canceled before downloading all required / pending tiles.

    SET_VIEW_EVENT

    Fired after a successful call into {Viewer3D#setView}.

    Properties

    viewThe view object that was applied.

    RENDER_FIRST_PIXEL

    Fired when the first pixel of the model is ready to be rendered.

    NEW_GEOMETRY_ADDED

    Fired when new geometry has been added to the scene

    NEW_MATERIAL_ADDED

    Fired when a new material has been added to the scene

    PROFILE_CHANGE_EVENT

    Fired when a profile is added to the viewer.profileManager

    PROFILE_CHANGE_EVENT

    Fired when a scene part is about to be rendered

    OBJECT_UNDER_MOUSE_CHANGED

    Fired when object under mouse changed.

    ANIM_ENDED

    Fired when AnimController calls Autodesk.Viewing.Private.fadeValue

    TRANSITION_STARTED

    Fired when transition started

    Properties

    sceneAnimState
    object
    // scene state of transition

    TRANSITION_ENDED

    Fired when transition ended

    Properties

    sceneAnimState
    object
    // scene state of transition, this will be null for models that do not have any clusters or animations

    FRAGMENTS_LOADED_EVENT

    Fired when fragments are loaded after the initial model load.

    Properties

    model
    object
    Model data.

    FRAGMENTS_UNLOADED_EVENT

    Fired when fragments are unloaded.

    Properties

    model
    object
    Model data.

    SCENE_UPDATED_EVENT

    Fired when scene is updated

    Properties

    model
    object
    Model data.

    VIEWER_VISIBILITY_CHANGED

    Fired when the viewers visibility has changed (i.e. a viewer window got shown or hidden).

    NOTE: This event relies on the checkVisibility method being available on DOM elements in the browser. If this feature is missing, the event will not be fired. This should be the case in all up-to-date browsers. Most browsers have added it in 2022, but Safari only at the beginning of 2024.

    Properties

    visible
    boolean
    True if the viewer is visible, false otherwise.

    VIEWER_RENDER_TICK

    Fired each rendering tick regardless of whether the viewer actually needs to render. This event is intended for updates that need to be in sync with the render loop.

    Example usage:

    ``this.viewer.addEventListener(VIEWER_RENDER_TICK, event) => { // do some update that needs to be in sync with the render loop }); ``

    SLOW_GPU_WARNING_EVENT

    Fired when the viewer detects that the GPU may be underperforming (e.g. integrated GPU, software renderer).

    Properties

    reason
    ‘integrated-gpu’, ‘software-renderer’
    Detected reason for the warning.
    rendererInfo
    Object
    Raw WebGL vendor/renderer strings.
    suppressDefault
    function
    Call to prevent the default HudMessage from being shown.

    TOOLBAR_CREATED_EVENT

    Fired after the toolbar UI gets instantiated.

    SETTINGS_PANEL_CREATED_EVENT

    Fired after the Settings panel gets instantiated.

    VIEW_CUBE_CREATED_EVENT

    Fired after the ViewCube gets instantiated.