Autodesk.Viewing.GuiViewer3D
Extends Viewer3D
new GuiViewer3D(container,config)
Viewer component based on Viewer3D with added UI.
Parameters
container* HTMLElement | The viewer container. |
config* object | The initial settings object. See base class for details. |
Methods
activateLayerState(stateName)
Inherits activateLayerState
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. |
addPanel(panel)
Adds a panel to the viewer. The panel will be moved and resized if the viewer is resized and the panel falls outside of the bounds of the viewer.
Parameters
panel* | The panel to add. |
Returns
Type | Description |
---|---|
boolean | True if panel was successfully added. |
applyCamera(camera,fit)
Inherits applyCamera
Parameters
camera* THREE.Camera | the camera to apply. |
fit boolean | Do a fit to view after transition. |
areAllVisible()
Inherits areAllVisible
Returns true if every node is visible.
Returns
Type | Description |
---|---|
boolean |
clearSelection()
Inherits clearSelection
Clears the selection.
clearThemingColors(model)
Inherits clearThemingColors
Restore original colors for all themed shapes.
Parameters
model Autodesk.Viewing.RenderModel | For multi-model support. |
clientToWorld(clientX,clientY,ignoreTransparent)
Inherits clientToWorld
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()
Inherits createViewCube
Create ViewCube.
displayViewCube(display)
Inherits displayViewCube
Display ViewCube.
Parameters
display* boolean | Display or hide the ViewCube. |
displayViewCubeUI(display)
Inherits displayViewCubeUI
Display ViewCube.
Parameters
display* boolean | Display or hide the ViewCube with home and info buttons. |
explode(scale)
Inherits explode
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()
Inherits finish
Unloads any loaded extensions and then uninitializes the viewer.
fitToView(objectIds,model)
Inherits fitToView
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)
Inherits getAggregateSelection
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()
Inherits getBimWalkToolPopup
Returns the state of First Person Walk tool popup
Not applicable to 2D.
Returns
Type | Description |
---|---|
boolean | value is indicating whether first person tool popup is showed or not |
getCamera()
Inherits getCamera
Gets the camera so it can be modified by the client.
Returns
Type | Description |
---|---|
THREE.Camera | The active camera. |
getClickConfig(what,where)
Inherits getClickConfig
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()
Inherits 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()
Inherits getDimensions
Returns
Type | Description |
---|---|
object | Client rectangle bounds. |
getExplodeScale()
Inherits getExplodeScale
Returns the explode scale.
Not applicable to 2D.
Returns
Type | Description |
---|---|
number |
|
getFirstPersonToolPopup()
Inherits getFirstPersonToolPopup
Returns the state of First Person Walk tool popup
Not applicable to 2D.
Returns
Type | Description |
---|---|
boolean | true if the First Person Walk tool popup appears, false if it does not appear |
getFocalLength()
Inherits getFocalLength
Gets the current camera focal length.
Returns
Type | Description |
---|---|
number |
|
getFOV()
Inherits getFOV
Gets the current camera vertical field of view.
Returns
Type | Description |
---|---|
number |
|
getIsolatedNodes()
Inherits 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()
Inherits getLayerStates
Returns information for each layer state: name, description, active. Activate a state through activateLayerState.
Returns
Type | Description |
---|---|
array |
getMemoryInfo()
Inherits 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)
Inherits getObjectTree
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)
Inherits getProperties
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)
Inherits getScreenShot
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)
Inherits getScreenShotBuffer
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()
Inherits getSelection
Returns the current selection.
Returns
Type | Description |
---|---|
array.<number> | Array of the IDs of the currently selected nodes. |
getSelectionCount()
Inherits getSelectionCount
Returns the number of nodes in the current selection.
Returns
Type | Description |
---|---|
number | Returns the number of nodes in the current selection. |
getSelectionVisibility()
Inherits getSelectionVisibility
Returns information about the visibility of the current selection.
Returns
Type | Description |
---|---|
object | {hasVisible:boolean, hasHidden:boolean} |
getState(filter)
Inherits getState
Gets the view state as a plain object.
Parameters
filter object | Specifies which viewer values to get. |
Returns
Type | Description |
---|---|
object | Viewer state. |
getToolbar(create)
Returns a toolbar.
Parameters
create* boolean | If true and the toolbar does not exist, it will be created. |
Returns
Type | Description |
---|---|
ToolBar | Returns the toolbar. |
hide(node)
Inherits hide
Ensures the passed in dbid / ids are hidden.
Parameters
node* array.<number>|number |
hideById(nodeId)
Inherits hideById
Parameters
nodeId* number |
hideLines(hide)
Inherits hideLines
Hides all lines in the scene.
Parameters
hide* boolean |
hideModel(modelId)
Inherits hideModel
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)
Inherits hidePoints
Hides all points in the scene.
Parameters
hide* boolean |
initialize()
Inherits initialize
Create any DOM and canvas elements, and setup WebGL.
Returns
Type | Description |
---|---|
number | 0 if initialization was successful, Autodesk.Viewing.ErrorCode otherwise. |
initSettings()
Inherits initSettings
Initializes all gui settings to their defaults or to the session stored setting This gives session stored settings priority
isLayerVisible(node)
Inherits isLayerVisible
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)
Inherits isNodeVisible
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)
Inherits isolate
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)
Inherits isolateById
Parameters
dbids* array|number | Either an array or a single integer. |
joinLiveReview(sessionId)
Inherits joinLiveReview
Join a live review session.
Parameters
sessionId string | The live review session id to join. |
leaveLiveReview()
Inherits leaveLiveReview
Leave a live review session.
loadModel(url,options,onSuccessCallback,onErrorCallback)
Inherits loadModel
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()
Inherits localize
Localize the viewer. This method can be overwritten so that the subclasses can localize any additional elements.
modelHasTopology()
Inherits 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)
Inherits playAnimation
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.");
}
removePanel(panel)
Removes a panel from the viewer. The panel will no longer be moved and resized if the viewer is resized.
Parameters
panel* | The panel to remove. |
Returns
Type | Description |
---|---|
boolean | True if panel was successfully removed. |
resize()
Inherits resize
Resizes the viewer.
resizePanels(options)
Resizes the panels currently held by the viewer.
Parameters
options object | An optional dictionary of options. |
dockingPanels array | A list of panels to resize. |
viewer object | The viewer to use, specify if this method is being used as a callback. |
dimensions object | The area for the panels to occupy. |
width* number | Width. |
height* number | Height. |
restoreState(viewerState,filter,immediate)
Inherits restoreState
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)
Inherits search
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)
Inherits select
Selects the array of ids. You can also just pass in a single id instead of an array.
Currently three ways of node selection are supported:
- Autodesk.Viewing.SelectionMode.MIXED
- Leaf nodes are selected using the overlayed selection type, and inner nodes are selected using regular selection type.
- Autodesk.Viewing.SelectionMode.REGULAR
- Nodes are tinted with the selection color.
- Autodesk.Viewing.SelectionMode.OVERLAYED
- Nodes are tinted with the selection color and shown on top of the not selected geometry.
Parameters
dbids* array.<number>|number | You can pass an array of IDs or just a single ID. |
selectionType* number | a member of Autodesk.Viewing.SelectionMode. |
setBackgroundColor(red,green,blue,red2,green2,blue2)
Inherits setBackgroundColor
Sets the background color.
Parameters
red* number | |
green* number | |
blue* number | |
red2* number | |
green2* number | |
blue2* number |
setBimWalkToolPopup(value)
Inherits setBimWalkToolPopup
Toggles the bimwalk
tool popup.
Not applicable to 2D.
Parameters
value* boolean | Indicates whether first person tool popup is showed or not. |
setCanvasClickBehavior(config)
Inherits setCanvasClickBehavior
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)
Inherits setClickConfig
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)
Inherits setClickToSetCOI
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)
Inherits setCutPlanes
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)
Inherits setDisplayEdges
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)
Inherits setEnvMapBackground
Toggles environment map for background.
Not applicable to 2D.
Parameters
value* boolean | Indicates whether environment map for background is on or off. |
setFirstPersonToolPopup(value)
Inherits setFirstPersonToolPopup
Toggles first person tool popup.
Not applicable to 2D.
Parameters
value* boolean | Indicates whether first person tool popup is showed or not. |
setFocalLength(mm)
Inherits setFocalLength
Sets the current cameras focal length.
Parameters
mm* number | Focal length in millimetres |
setFOV(degrees)
Inherits setFOV
Sets the current cameras vertical field of view.
Parameters
degrees* number | Field of view in degrees. |
setGhosting(value)
Inherits setGhosting
Toggles ghosting during search and isolate.
Not applicable to 2D.
Parameters
value* boolean | Indicates whether ghosting is on or off. |
setGroundReflection(value)
Inherits setGroundReflection
Toggles ground reflection.
Not applicable to 2D.
Parameters
value* boolean | Indicates whether reflection is on or off. |
setGroundReflectionAlpha(alpha)
Inherits setGroundReflectionAlpha
If enabled, set ground reflection alpha. This is reset to default when reflections toggled off.
Not applicable to 2D
Parameters
alpha* float |
setGroundReflectionColor(color)
Inherits setGroundReflectionColor
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)
Inherits setGroundShadow
Toggles ground shadow.
Not applicable to 2D.
Parameters
value* boolean | Indicates whether shadow is on or off. |
setGroundShadowAlpha(alpha)
Inherits setGroundShadowAlpha
If enabled, set ground shadow alpha
Not applicable to 2D
Parameters
alpha* float |
setGroundShadowColor(color)
Inherits setGroundShadowColor
If enabled, set ground shadow color
Not applicable to 2D
Parameters
color* THREE.Color |
setLayersPanel(layersPanel)
Sets the layers panel for display 2d layers.
Not yet implemented for 3D.
Parameters
layersPanel* | The layers panel to use, or null. |
Returns
Type | Description |
---|---|
boolean | True if the panel or null was set successfully, and false otherwise. |
setLayerVisible(nodes,visible,isolate)
Inherits setLayerVisible
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)
Inherits setLightPreset
Sets the Light Presets (Environments) for the Viewer.
Not applicable to 2D.
Sets the preference in the UI
Parameters
index* Number | where
|
setModelStructurePanel(modelStructurePanel)
Sets the model structure panel for displaying the loaded model.
Parameters
modelStructurePanel* | The model structure panel to use, or null. |
Returns
Type | Description |
---|---|
boolean | True if the panel, or null, was set successfully; false otherwise. |
setModelUnits(Model)
Inherits setModelUnits
Set model units
Parameters
Model* | units |
setOrbitPastWorldPoles(value)
Inherits setOrbitPastWorldPoles
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)
Inherits setProgressiveRendering
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 |
setPropertyPanel(propertyPanel)
Sets the property panel.
Parameters
propertyPanel* | The property panel to use, or null. |
Returns
Type | Description |
---|---|
boolean | True if the panel or null was set successfully, and false otherwise. |
setQualityLevel(useSAO,useFXAA)
Inherits setQualityLevel
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)
Inherits setRenderCache
Toggles the rendercache feature.
Not applicable to 2D.
Parameters
value* boolean | true if render cache is active, false if render cache is not active. |
setReverseHorizontalLookDirection(value)
Inherits setReverseHorizontalLookDirection
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)
Inherits setReverseVerticalLookDirection
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)
Inherits setReverseZoomDirection
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)
Inherits setSelectionColor
Changes the color of the selection for a particular selection type.
- Autodesk.Viewing.SelectionMode.MIXED
- Sets the same color for regular and overlayed selection.
- Autodesk.Viewing.SelectionMode.REGULAR
- Sets the color of regular selection.
- Autodesk.Viewing.SelectionMode.OVERLAYED
- Sets the color of overlayed selection.
Parameters
color* THREE.Color | |
selectionType* number | a member of Autodesk.Viewing.SelectionMode. |
Examples
viewer.setSelectionColor(new THREE.Color(0xFF0000), Autodesk.Viewing.SelectionMode.MIXED); // red color
setSelectionMode()
Inherits 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.
setSettingsPanel(settingsPanel)
Sets the viewer’s settings panel.
Parameters
settingsPanel* | The settings panel to use, or null. |
Returns
Type | Description |
---|---|
boolean | True if the panel or null was set successfully, and false otherwise. |
setSwapBlackAndWhite(value)
Inherits setSwapBlackAndWhite
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)
Inherits setThemingColor
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)
Inherits setUseLeftHandedInput
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)
Inherits setUsePivotAlways
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)
Inherits setViewCube
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)
Inherits setViewFromArray
Sets the view from an array of parameters.
Parameters
params* array | View parameters:
|
setViewFromFile()
Inherits setViewFromFile
Sets the view using the default view in the source file.
setViewFromViewBox(viewbox,name)
Inherits setViewFromViewBox
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)
Inherits setZoomTowardsPivot
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)
Inherits show
Ensures the passed in dbid / ids are shown.
Parameters
node* Array.<number>|number |
showAll()
Inherits showAll
Ensures everything is visible. Clears all node isolation (3D) and turns on all layers (2D).
showModel(modelId)
Inherits showModel
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)
Inherits start
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)
Inherits toggleSelect
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)
Inherits toggleVisibility
Toggles the visibility of the given node.
Not yet implemented for 2D.
Parameters
node* number |
trackADPSettingsOptions()
Inherits trackADPSettingsOptions
ADP
transferModel()
Inherits transferModel
Transfer model from this viewer to another one - including state of selection, ghosting, and theming.
uninitialize()
Inherits uninitialize
Removes all created DOM elements and performs any GL uninitialization that is needed.
worldToClient(point)
Inherits worldToClient
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 used 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 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.