Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Viewing

Index

Modules

Enumerations

Classes

Interfaces

Type aliases

Events

Functions

Type aliases

InitializerGetAccessTokenCallback

InitializerGetAccessTokenCallback: function

Code to retrieve and assign token value to accessToken and expire time in seconds.

Type declaration

InitializerGetAccessTokenSuccessCallback

InitializerGetAccessTokenSuccessCallback: function

Forge access token

Expiring time of the forge access token

Type declaration

    • (accessToken: string, expire: number): void
    • Parameters

      • accessToken: string
      • expire: number

      Returns void

InitializerInitializedCallback

InitializerInitializedCallback: function

A method the client executes when initialization is finished.

Type declaration

    • (): void
    • Returns void

Viewer3DContextMenuCallback

Viewer3DContextMenuCallback: function

Registered menu items.

Viewer status while triggering context menu.

Type declaration

Viewer3DGenericErrorCallback

Viewer3DGenericErrorCallback: function

Generic error callback.

The error

Type declaration

    • (error: any | string): void
    • Parameters

      • error: any | string

      Returns void

Viewer3DGetAggregateSelectionCallback

Viewer3DGetAggregateSelectionCallback: function

Reference to the loaded model.

Id of the selected element.

Type declaration

    • (model: Model, dbId: number): void
    • Parameters

      • model: Model
      • dbId: number

      Returns void

Viewer3DGetPropertiesSuccessCallback

Viewer3DGetPropertiesSuccessCallback: function

Success callback when fetching properties.

Properties for the requested id.

Type declaration

Viewer3DLoadModelErrorCallback

Viewer3DLoadModelErrorCallback: function

Error number

Error message

Type declaration

    • (errorCode: number, errorMessage: string): void
    • Parameters

      • errorCode: number
      • errorMessage: string

      Returns void

Viewer3DLoadModelSuccessCallback

Viewer3DLoadModelSuccessCallback: function

Reference to the loaded model.

Type declaration

    • Parameters

      Returns void

Viewer3DObjectTreeSuccessCallback

Viewer3DObjectTreeSuccessCallback: function

Success callback when fetching the instanceTree.

The model's InstanceTree.

Type declaration

Viewer3DSearchSuccessCallback

Viewer3DSearchSuccessCallback: function

Success callback when searching a model's property database.

An array of ids that contain properties matching the search query.

Type declaration

    • (ids: number[]): void
    • Parameters

      • ids: number[]

      Returns void

Events

Const AGGREGATE_FIT_TO_VIEW_EVENT

AGGREGATE_FIT_TO_VIEW_EVENT: string

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

selection: object[] List of objects each containing a model instance and a selection array of ids.

Const AGGREGATE_ISOLATION_CHANGED_EVENT

AGGREGATE_ISOLATION_CHANGED_EVENT: string

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

isolation: object[] List of objects containing the typical selection properties of Autodesk.Viewing.ISOLATE_EVENT for each model.

Const AGGREGATE_SELECTION_CHANGED_EVENT

AGGREGATE_SELECTION_CHANGED_EVENT: string

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

selections: object[] List of objects containing the typical selection properties of Autodesk.Viewing.SELECTION_CHANGED_EVENT for each model.

Const ANIMATION_READY_EVENT

ANIMATION_READY_EVENT: string

Fired when animations are successfully initialized.

Const CAMERA_CHANGE_EVENT

CAMERA_CHANGE_EVENT: string

Fired when a camera changes.

camera: THREE.Camera Affected camera.

Const CAMERA_TRANSITION_COMPLETED

CAMERA_TRANSITION_COMPLETED: string

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

Const CANCEL_LEAFLET_SCREENSHOT

CANCEL_LEAFLET_SCREENSHOT: string

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

Const CUTPLANES_CHANGE_EVENT

CUTPLANES_CHANGE_EVENT: string

Fired when the cutting planes change.

planes: THREE.Vector4[] List of cut planes.

Const ESCAPE_EVENT

ESCAPE_EVENT: string

Fired when the ESC key is pressed.

Const EXPLODE_CHANGE_EVENT

EXPLODE_CHANGE_EVENT: string

Fired whenever the Explode tool is used.

scale: number Scale of the current exploded state.

Const EXTENSION_LOADED_EVENT

EXTENSION_LOADED_EVENT: string

Fired when a viewer extension is successfully loaded.

extensionId: string Extension identifier.

Const EXTENSION_UNLOADED_EVENT

EXTENSION_UNLOADED_EVENT: string

Fired when a viewer extension is successfully unloaded.

extensionId: string Extension identifier.

Const FINAL_FRAME_RENDERED_CHANGED_EVENT

FINAL_FRAME_RENDERED_CHANGED_EVENT: string

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.

finalFrame: boolean final frame is displayed this tick.

Const FIT_TO_VIEW_EVENT

FIT_TO_VIEW_EVENT: string

Fired when a fitToView operation is applied.

immediate: boolean True if the change was immediate.

nodeIdArray: number[] List of node IDs fitted. Array is empty when fitting to the whole model.

model: Model Model data.

Const FRAGMENTS_LOADED_EVENT

FRAGMENTS_LOADED_EVENT: string

Fired when fragments are loaded on demand

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

Const FULLSCREEN_MODE_EVENT

FULLSCREEN_MODE_EVENT: string

Fired when the screen mode changes.

mode: ScreenMode New screen mode.

Const GEOMETRY_DOWNLOAD_COMPLETE

GEOMETRY_DOWNLOAD_COMPLETE: string

Use GEOMETRY_DOWNLOAD_COMPLETE_EVENT instead. Fired when fragments are loaded on demand

model: Model The model that loaded the fragment

memoryLimited: boolean Set to true if the model was loaded in memory limited mode

Const GEOMETRY_DOWNLOAD_COMPLETE_EVENT

GEOMETRY_DOWNLOAD_COMPLETE_EVENT: string

Fired when fragments are loaded on demand

model: Model The model that loaded the fragment

memoryLimited: boolean Set to true if the model was loaded in memory limited mode

Const GEOMETRY_LOADED_EVENT

GEOMETRY_LOADED_EVENT: string

Fired when the model/drawing finishes loading.

model: Model Model data.

Const HIDE_EVENT

HIDE_EVENT: string

Fired when the viewer hides a set of objects.

nodeIdArray: number[] List of hidden node IDs.

Const HYPERLINK_EVENT

HYPERLINK_EVENT: string

Fired when user clicks on a hyperlink embedded in the model.

data: object Hyperlink data.

Const ISOLATE_EVENT

ISOLATE_EVENT: string

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

nodeIdArray:number[] List of isolated node IDs.

model: Model Model data.

Const LAYER_VISIBILITY_CHANGED_EVENT

LAYER_VISIBILITY_CHANGED_EVENT: string

Fired when visibility of a 2D layer changes.

Const LOAD_GEOMETRY_EVENT

LOAD_GEOMETRY_EVENT: string

item: Any

onSuccessCb: Function

onErrorCb: Function

Const LOAD_MISSING_GEOMETRY

LOAD_MISSING_GEOMETRY: string

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

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

Const MODEL_ADDED_EVENT

MODEL_ADDED_EVENT: string

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

model: Model Model data.

Const MODEL_LAYERS_LOADED_EVENT

MODEL_LAYERS_LOADED_EVENT: string

Fired when the layers of the model are successfully loaded.

root: object Model layers root.

model: Model Model data.

Const MODEL_REMOVED_EVENT

MODEL_REMOVED_EVENT: string

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

model: Model Model data.

Const MODEL_ROOT_LOADED_EVENT

MODEL_ROOT_LOADED_EVENT: string

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

svf: object Parsed SVF/F2D JSON.

model: Model Model data.

Const MODEL_UNLOADED_EVENT

MODEL_UNLOADED_EVENT: string

Fired when a model is removed from the viewer.

model: Model Model data.

Const NAVIGATION_MODE_CHANGED_EVENT

NAVIGATION_MODE_CHANGED_EVENT: string

Fired then the navigation tool changes.

id: string Tool identifier.

Const OBJECT_TREE_CREATED_EVENT

OBJECT_TREE_CREATED_EVENT: string

Fired when the instance tree is successfully created.

svf: object Parsed SVF/F2D JSON.

model: Model Model data.

Const OBJECT_TREE_UNAVAILABLE_EVENT

OBJECT_TREE_UNAVAILABLE_EVENT: string

Fired when there's an error while parsing the instance tree.

svf: object Parsed SVF/F2D JSON.

model: Model Model data.

Const PREF_CHANGED_EVENT

PREF_CHANGED_EVENT: string

Fired when a user preference property changes.

name: string property name.

value: object New property value.

Const PREF_RESET_EVENT

PREF_RESET_EVENT: string

Fired when a user preference property is reset.

name: string property name.

value: object New property value.

Const PROGRESS_UPDATE_EVENT

PROGRESS_UPDATE_EVENT: string

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

percent: number Estimated progress.

state: number Value from Autodesk.Viewing.ProgressState, providing details on the progress state.

model: Model Model being loaded.

Const RENDER_OPTION_CHANGED_EVENT

RENDER_OPTION_CHANGED_EVENT: string

Fired when rendering options change.

Const RENDER_PRESENTED_EVENT

RENDER_PRESENTED_EVENT: string

Fired when the render has presented to the screen.

Const RESET_EVENT

RESET_EVENT: string

Fired when a model is reset to its initial configuration.

Const RESTORE_DEFAULT_SETTINGS_EVENT

RESTORE_DEFAULT_SETTINGS_EVENT: string

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.

Const SELECTION_CHANGED_EVENT

SELECTION_CHANGED_EVENT: string

Fired when the list of selected objects changes.

ragIdsArray: number[] Fragment IDs of selected objects.

dbIdArray: number[] dbIDs of selected objects.

nodeArray: number[] Same as dbIdArray.

model: Model Model data.

Const SHOW_EVENT

SHOW_EVENT: string

Fired when the viewer shows a set of objects.

nodeIdArray: number[] List of shown node IDs.

Const TEXTURES_LOADED_EVENT

TEXTURES_LOADED_EVENT: string

Fired when the model/drawing textures finish loading.

model: Model Model data.

Const TOOL_CHANGE_EVENT

TOOL_CHANGE_EVENT: string

Fired when a tool is activated or deactivated.

toolName: string Name of a specific mode of a tool.

tool: ToolInterface Tool object.

active: bool Current status of the tool.

Const VIEWER_INITIALIZED

VIEWER_INITIALIZED: string

Fired when the viewer is fully initialized.

Const VIEWER_RESIZE_EVENT

VIEWER_RESIZE_EVENT: string

Fired when the viewer size changes.

width: number New width of the viewer.

height: number New height of the viewer.

Const VIEWER_STATE_RESTORED_EVENT

VIEWER_STATE_RESTORED_EVENT: string

Fired when the viewer state is restored.

value: boolean Success of the state restoration.

Const VIEWER_UNINITIALIZED

VIEWER_UNINITIALIZED: string

Fired when the viewer is fully uninitialized.

Const WEBGL_CONTEXT_LOST_EVENT

WEBGL_CONTEXT_LOST_EVENT: string

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

Functions

Initializer

  • Helper class for initializing the viewer runtime.

    Includes:

    • End points of cloud services the viewer uses, like viewing service and search service.
    • Authentication and authorization cookie settings on the client side.
    • Misc runtime environment variables and viewer configurations parameters.
    
     var options = {
        env: "AutodeskProduction",
        language: "en",
        webGLHelpLink: "http://my.webgl.help.link",
        getAccessToken: function( onSuccess ) {
            var accessToken, expire;
            // Code to retrieve and assign token value to
            // accessToken and expire time in seconds.
            onSuccess( accessToken, expire );
        }
     };
    
     var viewerDiv = document.getElementById( 'MyViewerDiv' );
     var viewer = new Autodesk.Viewing.Private.GuiViewer3D( viewerDiv );
     var documentId = 'urn:<YOUR_URN_ID>';
    
     function onDocumentLoadSuccess(doc) {
       var geometries = doc.getRoot().search({'type':'geometry'});
       if( geometries.length === 0 ) {
         console.error( 'Document contains no geometries.' );
         return;
       }
    
       var svfUrl = doc.getViewablePath( initGeom );
       var modelOptions = {
         sharedPropertyDbPath: doc.getPropertyDbPath();
       };
       viewer.start( svfUrl, modelOptions, onLoadModelSuccess, onLoadModelError );
     }
    
     var onInitialized = function() {
       Autodesk.Viewing.Document.load( documentId, onDocumentLoadSuccess, onDocumentLoadFailure );
     };
    
     Autodesk.Viewing.Initializer( options, onInitialized );

    Parameters

    • options: InitializerOptions

      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.

    • callback: InitializerInitializedCallback

      A method the client executes when initialization is finished.

    Returns void

Autodesk 2018 © All Rights Reserved