Autodesk.Viewing.Viewer3D
new Viewer3D(container,config)
Base class for all viewer implementations.
It contains everything that is needed to connect to the Autodesk viewing service and display 3D models. It also includes basic navigation support, and context menu and extension APIs.
Parameters
| container* HTMLElement | The viewer container. |
| config* object | The initial settings object. |
| startOnInitialize boolean | Set this to false if you want to defer the run to a later time by calling run() explicitly. |
Methods
activateLayerState(stateName)
Changes the active layer state. Get a list of all available layerStates and their active status through getLayerStates.
Parameters
| stateName* string | Name of the layer state to activate. |
applyCamera(camera,fit)
Parameters
| camera* THREE.Camera | the camera to apply. |
| fit boolean | Do a fit to view after transition. |
areAllVisible()
Returns true if every node is visible.
Returns
| Type | Description |
|---|---|
| boolean |
clearSelection()
Clears the selection.
clearThemingColors(model)
Restore original colors for all themed shapes.
Parameters
| model Autodesk.Viewing.RenderModel | For multi-model support. |
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().
Parameters
| clientX* Number | X coordinate where 0 is left |
| clientY* Number | Y coordinate where 0 is top |
| ignoreTransparent Boolean | Ignores transparent materials |
Returns
| Type | Description |
|---|---|
| Object|null | contains point attribute. 3d models have additional attributes. |
createViewCube()
Create ViewCube.
displayViewCube(display)
Display ViewCube.
Parameters
| display* boolean | Display or hide the ViewCube. |
displayViewCubeUI(display)
Display ViewCube.
Parameters
| display* boolean | Display or hide the ViewCube with home and info buttons. |
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. |
finish()
Unloads any loaded extensions and then uninitializes the viewer.
fitToView(objectIds,model)
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. To enqueue a fitToView() operation, use viewer.getObjectTree()’s callback(s).
Parameters
| objectIds array|int | array of Ids, or null. |
| model model | The model containing the objectIds. |
getAggregateSelection(callback)
Returns the selected items from all loaded models.
Parameters
| callback function | Optional callback to receive enumerated pairs of model and dbId for each selected object. If no callback is given, an array of objects is returned. |
Returns
| Type | Description |
|---|---|
| array.<object> | An array of objects with a model and selectionSet properties for each model that has selected items in the scene. |
getBimWalkToolPopup()
Returns the state of first person tool popup
Not applicable to 2D.
Returns
| Type | Description |
|---|---|
| boolean | value is indicating whether first person tool popup is showed or not |
getCamera()
Gets the camera so it can be modified by the client.
Returns
| Type | Description |
|---|---|
| THREE.Camera | The active camera. |
getClickConfig(what,where)
Fetch a click action configuration entry.
Parameters
| what* string | which click config to fetch (one of “click”, “clickAlt”, “clickCtrl”, “clickShift”, “clickCtrlShift”). |
| where* string | hit location selector (one of “onObject”, “offObject”). |
Returns
| Type | Description |
|---|---|
| array | action list for the given entry or null if not found. |
getCutPlanes()
Returns a list of active cut planes
Not applicable to 2D
Returns
| Type | Description |
|---|---|
| array.<THREE.Vector4> | List of Vector4 plane representation {x:a, y:b, z:c, w:d} |
getDimensions()
Returns
| Type | Description |
|---|---|
| object | Client rectangle bounds. |
getExplodeScale()
Returns the explode scale.
Not applicable to 2D.
Returns
| Type | Description |
|---|---|
| number |
|
getFirstPersonToolPopup()
Returns the state of first person tool popup
Not applicable to 2D.
Returns
| Type | Description |
|---|---|
| boolean | true if the First Person Walk tool popup appears, false if the First Person Walk tool popup does not appear. |
getFocalLength()
Gets the current camera focal length.
Returns
| Type | Description |
|---|---|
| number |
|
getFOV()
Gets the current camera vertical field of view.
Returns
| Type | Description |
|---|---|
| number |
|
getIsolatedNodes()
Returns an array of the IDs of the currently isolated nodes.
Not yet implemented for 2D.
Returns
| Type | Description |
|---|---|
| array | Array of nodes that are currently isolated. |
getLayerStates()
Returns information for each layer state: name, description, active. Activate a state through activateLayerState.
Returns
| Type | Description |
|---|---|
| array |
getMemoryInfo()
Get the memory stats when using on demand loading.
Returns
| Type | Description |
|---|---|
| object|null | Object containing the total limit and total loaded memory usage for all models.
Return null if no model is being loaded on demand. |
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 function | Call this callback once the object tree is loaded. |
| onErrorCallback function | Call this callback if the object tree is not found. |
getProperties(dbid,onSuccessCallback,onErrorCallback)
Gets the properties for an ID. Once the properties are returned, the method raises a onPropertiesReady event.
Parameters
| dbid* number | |
| onSuccessCallback function | Call this callback once the properties are found. |
| onErrorCallback function | Call this callback if the properties are not found, or another error occurs. |
getScreenShot(w,h,cb)
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. See also getScreenShotBuffer().
Parameters
| w int | width of the requested image |
| h int | height of the requested image |
| cb function | callback |
Returns
| Type | Description |
|---|---|
| DOMString | screenshot image Blob URL, if no parameters are given |
getScreenShotBuffer(w,h,cb)
Alternative call to getScreenShot() which internally uses additional steps (more processing) to generate the screenshot.
Parameters
| w int | width of the requested image |
| h int | height of the requested image |
| cb function | callback |
getSelection()
Returns the current selection.
Returns
| Type | Description |
|---|---|
| array.<number> | Array of the IDs of the currently selected nodes. |
getSelectionCount()
Returns the number of nodes in the current selection.
Returns
| Type | Description |
|---|---|
| number |
getSelectionVisibility()
Returns information about the visibility of the current selection.
Returns
| Type | Description |
|---|---|
| object | {hasVisible:boolean, hasHidden:boolean} |
getState(filter)
Gets the view state as a plain object.
Parameters
| filter object | Specifies which viewer values to get. |
Returns
| Type | Description |
|---|---|
| object | Viewer state. |
hide(node)
Ensures the passed in dbid / ids are hidden.
Parameters
| node* array.<number>|number | An array of dbids or just an id |
hideLines(hide)
Hides all lines in the scene.
Parameters
| hide* boolean |
hideModel(modelId)
Temporarily remove a model from the Viewer, but keep loaders, materials, and geometry alive.
Parameters
| modelId* |
Returns
| Type | Description |
|---|---|
| boolean | true indicates success, i.e., modelId referred to a visible model that is now hidden |
hidePoints(hide)
Hides all points in the scene.
Parameters
| hide* boolean |
initialize()
Create any DOM and canvas elements, and setup WebGL.
Returns
| Type | Description |
|---|---|
| number | 0 if initialization was successful, Autodesk.Viewing.ErrorCode otherwise. |
initSettings()
Initializes all gui settings to their defaults or to the session stored setting This gives session stored settings priority
isLayerVisible(node)
Returns true if the layer is visible.
Not yet implemented for 3D.
Parameters
| node* Object | Layer node |
Returns
| Type | Description |
|---|---|
| boolean | true if the layer is visible |
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 | The model that contains the specified
nodeId. |
Returns
| Type | Description |
|---|---|
| boolean |
isolate(node)
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 BaseViewer#getObjectTree. |
isolateById(dbids)
Parameters
| dbids* array|number | Either an array or a single integer. |
joinLiveReview(sessionId)
Join a live review session.
Parameters
| sessionId string | The live review session id to join. |
leaveLiveReview()
Leave a live review session.
loadModel(url,options,onSuccessCallback,onErrorCallback)
Loads a model into the viewer.
Parameters
| url* string | The url to the model. |
| options object | An optional dictionary of options. |
| fileLoader | The file loader to use for this url. |
| 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. |
| onSuccessCallback function | A method that gets called when initial loading is done and streaming starts. |
| onErrorCallback function | A method that gets called when loading fails. |
localize()
Localize the viewer. This method can be overwritten so that the subclasses can localize any additional elements.
modelHasTopology()
Expose if the model has topology information downloaded. Only applicable to 3D models.
Returns
| Type | Description |
|---|---|
| boolean | value - Indicates whether the model has topology information. |
playAnimation(callback)
Play animation if animation data is available as part of model data. If the model data does not contain any animation, this function call is a no op.
Parameters
| callback function | Callback function that would be invoked at each frame of the animation. The callback function takes a single input value, with value range between 0 and 100, inclusive, with value 100 indicates the animation has finished playing. |
Examples
Here is an example of callback function.
function(value) {
if (value < 100)
console.log("Animation progress: " + value + "%.");
else
console.log("Animation finished.");
}
resize()
Resizes the viewer.
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 values that should not be restored. |
| immediate boolean | Whether the new view is applied with (true) or without transition (false). |
Returns
| Type | Description |
|---|---|
| boolean | True if restore operation was successful. |
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* function | The callback to invoke when search is complete. |
| onErrorCallback* function | The callback to invoke when search is complete. |
| attributeNames array.<string> | Restricts search to specific attribute names. |
select(dbids,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 the 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 | |
| selectionType* number | a member of Autodesk.Viewing.SelectionMode. |
setBackgroundColor(red,green,blue,red2,green2,blue2)
Sets the background color.
Parameters
| red* number | |
| green* number | |
| blue* number | |
| red2* number | |
| green2* number | |
| blue2* number |
setBimWalkToolPopup(value)
Toggles bimwalk tool popup.
Not applicable to 2D.
Parameters
| value* boolean | true if the First Person Walk tool popup appears, false if it does not appear |
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. |
Examples
{
"click": {
"onObject": [ACTIONS],
"offObject": [ACTIONS]
},
"clickCtrl": {
"onObject": [ACTIONS],
"offObject": [ACTIONS]
},
"clickShift": {
...
},
"clickCtrlShift": {
...
},
"disableSpinner": BOOLEAN
"disableMouseWheel": BOOLEAN,
"disableTwoFingerSwipe": BOOLEAN
}
Actions can be any of the following:
- selectOnly
- selectToggle
- deselectAll
- isolate
- showAll
- setCOI
- focus
- hide
setClickConfig(what,where,newAction)
Modifies a click action configuration entry.
Parameters
| what* string | which click config to modify (one of “click”, “clickAlt”, “clickCtrl”, “clickShift”, “clickCtrlShift”). |
| where* string | hit location selector (one of “onObject”, “offObject”). |
| newAction* array|string | action list (containing any of “setCOI”, “selectOnly”, “selectToggle”, “deselectAll”, “deselectAll”, “isolate”, “showAll”, “hide”, “focus”). |
Returns
| Type | Description |
|---|---|
| boolean | False if specified entry is not found, otherwise true. |
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. |
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 zero Passing an empty list or null is equivalent to setting zero cut planes |
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 |
setEnvMapBackground(value)
Toggles environment map for background.
Not applicable to 2D.
Parameters
| value* boolean | Indicates whether environment map for background is on or off. |
setFirstPersonToolPopup(value)
Toggles first person tool popup.
Not applicable to 2D.
Parameters
| value* boolean | Indicates whether first person tool popup is showed or not. |
setFocalLength(mm)
Sets the current cameras focal length.
Parameters
| mm* number | Focal length in millimetres |
setFOV(degrees)
Sets the current cameras vertical field of view.
Parameters
| degrees* number | Field of view in degrees. |
setGhosting(value)
Toggles ghosting during search and isolate.
Not applicable to 2D.
Parameters
| value* boolean | Indicates whether ghosting is on or off. |
setGroundReflection(value)
Toggles ground reflection.
Not applicable to 2D.
Parameters
| value* boolean | Indicates whether reflection is on or off. |
setGroundReflectionAlpha(alpha)
If enabled, set ground reflection alpha. This is reset to default when reflections toggled off.
Not applicable to 2D
Parameters
| alpha* float |
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 |
setGroundShadow(value)
Toggles ground shadow.
Not applicable to 2D.
Parameters
| value* boolean | Indicates whether shadow is on or off. |
setGroundShadowAlpha(alpha)
If enabled, set ground shadow alpha
Not applicable to 2D
Parameters
| alpha* float |
setGroundShadowColor(color)
If enabled, set ground shadow color
Not applicable to 2D
Parameters
| color* THREE.Color |
setLayerVisible(nodes,visible,isolate)
Set visibility for a single layer, or for all layers.
Not yet implemented for 3D.
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 |
setLightPreset(index)
Sets the Light Presets (Environments) for the Viewer.
Not applicable to 2D.
Sets the preference in the UI
Parameters
| index* Number | where
|
setModelUnits(Model)
Set model units
Parameters
| Model* | units |
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. |
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 |
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. |
setRenderCache(value)
Toggles rendercache feature.
Not applicable to 2D.
Parameters
| value* boolean | true if render cache is active, false if render cache is not active. |
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 |
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 |
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 |
setSelectionColor(color,selectionType)
Changes 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. |
Examples
viewer.setSelectionColor(new THREE.Color(0xFF0000), Autodesk.Viewing.SelectionMode.MIXED); // red color
setSelectionMode()
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.
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 |
setThemingColor(dbId,color,model)
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.RenderModel | For multi-model support. |
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. |
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.) |
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
"[front/back], [top/bottom], [left/rig
ht]". |
setViewFromArray(params)
Sets the view from an array of parameters.
Parameters
| params* array | View parameters:
|
setViewFromFile()
Sets the view using the default view in the source file.
setViewFromViewBox(viewbox,name)
Sets the view from an array representing a view box.
Not applicable to 3D.
Parameters
| viewbox* array | View parameters:
|
| name string | Optional named view name to also set the layer visibility state associated with this view. |
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 |
show(node)
Ensures the passed in dbid / ids are shown.
Parameters
| node* array.<number>|number |
showAll()
Ensures everything is visible. Clears all node isolation (3D) and turns on all layers (2D).
showModel(modelId)
Make a previously hidden model visible again.
Parameters
| modelId* |
Returns
| Type | Description |
|---|---|
| boolean | true indicates success, i.e., modelId referred to a hidden model that is now
visible |
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 function | Method that gets called when initial loading is done and streaming starts. |
| onErrorCallback function | Method that gets called when initial loading ends with an error. |
Returns
| Type | Description |
|---|---|
| number | 0 if the viewer has started, an error code (same as that returned by initialize()) otherwise. |
toggleSelect(dbid,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 OVERLAYED 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 | |
| selectionType* number | a member of Autodesk.Viewing.SelectionMode. |
toggleVisibility(node)
Toggles the visibility of the given node.
Not yet implemented for 2D.
Parameters
| node* number |
trackADPSettingsOptions()
ADP
transferModel()
Transfer model from this viewer to another one - including state of selection, ghosting, and theming.
uninitialize()
Removes all created DOM elements and performs any GL uninitialization that is needed.
worldToClient(point)
Calculates the pixel position in client space coordinates of a point in world space. See also clientToWorld().
Parameters
| point* THREE.Vector3 | Point in world space coordinates. |
Returns
| Type | Description |
|---|---|
| THREE.Vector3 | Point transformed and projected into client space coordinates. Z value is 0. |
Events
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 Autodesk.Viewing.Viewer3D#SELECTION_CHANGED_EVENT for each model. |
ANIMATION_READY_EVENT
Fired when animations are successfully initialized.
CAMERA_CHANGE_EVENT
Fired when a camera changes.
Properties
| camera object | Affected camera. |
CUTPLANES_CHANGE_EVENT
Fired when the cutting planes change.
Properties
| planes array.<object> | List of cutplanes. |
ESCAPE_EVENT
Fired when the ESC key is pressed.
EXPLODE_CHANGE_EVENT
Fired whenever the Explode tool is used.
Properties
| scale number | Scale of the current exploded state. |
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. |
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.
Properties
| planes array.<object> | List of cut planes. |
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. |
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 |
FULLSCREEN_MODE_EVENT
Fired when the screen mode changes.
Properties
| mode Autodesk.Viewing.ScreenMode | New screen mode. |
GEOMETRY_LOADED_EVENT
Fired when the model/drawing finishes loading.
Properties
| model object | Model data. |
HIDE_EVENT
Fired when the viewer hides a set of objects.
Properties
| nodeIdArray array.<number> | List of hidden node IDs. |
| model object | Model data. |
HYPERLINK_EVENT
Fired when user clicks on a hyperlink embedded in the model.
Properties
| data object | Hyperlink data. |
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. |
LAYER_VISIBILITY_CHANGED_EVENT
Fired when visibility of a 2D layer changes.
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. |
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. |
MODEL_UNLOADED_EVENT
Fired when a model is removed from the viewer.
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. |
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 single user preference property is reset.
Properties
| name string | Property name. |
| value object | New property value. |
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. |
RENDER_OPTION_CHANGED_EVENT
Fired when rendering options change.
RENDER_PRESENTED_EVENT
Fired when the render has presented to the screen.
RESET_EVENT
Fired when a model is reset to its initial configuration.
RESTORE_DEFAULT_SETTINGS_EVENT
Fired when the user clicks on the UI for restoring default settings. Will get fired after all other Autodesk.Viewing.PREF_CHANGED_EVENT get fired.
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. |
SHOW_EVENT
Fired when the viewer shows a set of objects.
Properties
| nodeIdArray array.<number> | List of shown node IDs. |
| model object | Model data. |
TEXTURES_LOADED_EVENT
Fired when the model/drawing textures finish loading.
Properties
| model object | Model data. |
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. |
VIEWER_INITIALIZED
Fired when the viewer is fully initialized.
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_STATE_RESTORED_EVENT
Fired when the viewer state is restored.
Properties
| value bool | Success of the state restoration. |
VIEWER_UNINITIALIZED
Fired when the viewer is fully uninitialized.