Request

Response

    Autodesk

    Viewing

    Namespace holding public API classes, functions, constants and events.

    new Object()

    Methods

    createViewerConfig()

    Returns a new object that can be passed to a Viewer instance when created.

    Available since version 2.13

    Returns

    typedescription
    ViewerConfig Can be passed into a ViewingApplication’s registerViewer() 3rd parameter, or directly when constructing a Viewer instance.

    Examples

    var myConfig = Autodesk.Viewing.createViewerConfig();
    

    myConfig.extensions.push(‘MyAwesomeExtension’); // // Direct usage… var myViewer = new Autodesk.Viewing.Viewer3D( myDiv, myConfig ); // // …or through a ViewingApplication viewerApp = new Autodesk.Viewing.ViewingApplication(‘MyViewerDiv’); viewerApp.registerViewer(viewerApp.k3D, Autodesk.Viewing.Private.GuiViewer3D, myConfig);


    createInitializerOptions()

    Returns a new object that can be passed to Autodesk.Viewing.Initializer() for initialization. Developers should consider customizing attributes in this object before passing it to Autodesk.Viewing.Initializer().

    Available since version 2.13

    Returns

    typedescription
    InitOptions Can be passed into Autodesk.Viewing.Initializer()

    Examples

     var options = Autodesk.Viewing.createInitializerOptions();
    options.getAccessToken = function(onSuccess) {
        var accessToken, expire;
        // Code to retrieve and assign token value to
        // accessToken and expire time in seconds.
        onSuccess(accessToken, expire);
    };
    Autodesk.Viewing.Initializer(options, function() {
        alert("initialization complete");
    });
    
    Show More

    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.

    FULLSCREEN_MODE_EVENT

    Fired when the screen mode changes.

    Properties

    mode
    Autodesk.Viewing.ScreenMode
    New screen mode.

    VIEWER_STATE_RESTORED_EVENT

    Fired when the viewer state is restored.

    Properties

    value
    bool
    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.

    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 instance tree is successfully created.

    Properties

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

    OBJECT_TREE_UNAVAILABLE_EVENT

    Fired when there’s an error while parsing the instance 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.

    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.

    MODEL_LAYERS_LOADED_EVENT

    Fired when the layers of the model are successfully loaded.

    Properties

    root
    object
    Model layers root.
    model
    object
    Model data.

    EXTENSION_LOADED_EVENT

    Fired when a viewer extension is successfully loaded.

    Properties

    extensionId
    string
    Extension identifier.

    EXTENSION_UNLOADED_EVENT

    Fired when a viewer extension is successfully unloaded.

    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 Autodesk.Viewing#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 Autodesk.Viewing#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.

    SHOW_EVENT

    Fired when the viewer shows a set of objects.

    Properties

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

    CAMERA_CHANGE_EVENT

    Fired when a camera changes.

    Properties

    camera
    object
    Affected camera.

    EXPLODE_CHANGE_EVENT

    Fired whenever the Explode tool is used.

    Properties

    scale
    number
    Scale 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
    bool
    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
    bool
    final frame is displayed this tick.

    RENDER_PRESENTED_EVENT

    Fired when the render has presented to the screen.

    LAYER_VISIBILITY_CHANGED_EVENT

    Fired when visibility of a 2D layer changes.

    RESET_EVENT

    Fired when a model is reset to its initial configuration.

    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.

    FRAGMENTS_LOADED_EVENT

    Fired when fragments are loaded on demand

    Properties

    model
    Model
    The model that loaded the fragment
    getFragIds
    function
    A function used to return the list of fragment ids loaded
    data
    Object
    Data use to generate the fragment ids

    GEOMETRY_DOWNLOAD_COMPLETE

    Properties

    model
    Model
    The model that loaded the fragment
    memoryLimited
    boolean
    Set to true if the model was loaded in memory limited mode

    GEOMETRY_DOWNLOAD_COMPLETE

    Fired when fragments are loaded on demand

    Properties

    model
    Model
    The model that loaded the fragment
    memoryLimited
    boolean
    Set to true if the model was loaded in memory limited mode

    WEBGL_CONTEXT_LOST_EVENT

    Fired when the drawing buffer associated with a WebGLRenderingContext object has been lost

    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 {Autodesk.Viewing.Viewer3D#setView}.

    Properties

    view
    Autodesk.Viewing.BubbleNode
    The view object that was applied.

    RENDER_FIRST_PIXEL

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