WebViewer

class Communicator.WebViewer()

Constructors


Constructors

WebViewer.constructor(inputParams)

Creates a new Web Viewer instance. You must pass in a containerId key with the ID of an element or a container element to use for your viewer. The system will create any required elements inside the supplied container.

Arguments
Return type

WebViewer()

Properties

WebViewer.BCFManager
Type

BCFManager()

WebViewer.animationManager
Type

Manager()

WebViewer.cuttingManager
Type

CuttingManager()

WebViewer.explodeManager
Type

ExplodeManager()

WebViewer.floorplanManager
Type

FloorplanManager()

WebViewer.lineManager
Type

LineManager()

WebViewer.markupManager
Type

MarkupManager()

WebViewer.measureManager
Type

MeasureManager()

WebViewer.model
Type

Model()

WebViewer.noteTextManager
Type

NoteTextManager()

WebViewer.operatorManager
Type

OperatorManager()

WebViewer.overlayManager
Type

OverlayManager()

WebViewer.selectionManager
Type

SelectionManager()

WebViewer.sheetManager
Type

SheetManager()

WebViewer.view
Type

View()

Methods

advanceExportToSvg

WebViewer.advanceExportToSvg()

Get the next chunk of the SVG code

Return type

Promise <string | undefined>

Returns

A promise that resolves to a string containing the next chunk or undefined on completed..

beginExportToSvg

WebViewer.beginExportToSvg([config])

Setup the env to export the current scene to a two-dimensional SVG representation through stream.

Arguments
  • config (SvgConfig()) – optional Allows customization of the resultant SVG.

Return type

Promise <void>

Returns

A promise that resolves to void when the env is ready.

closeConnection

WebViewer.closeConnection()

Disconnects the network connection when in CSR mode.

Return type

void

deactivateSheets

WebViewer.deactivateSheets()

Deactivate sheets and only display 3D content

Deprecated

Use SheetManager.deactivateSheets from sheetManager instead.

Return type

Promise <void>

Returns

promise that resolves when the operation has completed

delayCapping

WebViewer.delayCapping()

Delays capping processing by a fixed time interval.

Return type

void

endExportToSvg

WebViewer.endExportToSvg()

Reset the env after SVG stream export.

Return type

Promise <void>

Returns

A promise that resolves to void when the env is reset.

endSheetComparison

WebViewer.endSheetComparison()

Disables a visual comparison of two drawing sheets enabled by startSheetComparison The Promise returned by that function should be waited upon before calling endSheetComparison

Deprecated

Use SheetManager.endComparison from sheetManager instead.

Return type

Promise <void>

exportToSvg

WebViewer.exportToSvg([config])

Exports the current scene to a two-dimensional SVG representation.

Arguments
  • config (SvgConfig()) – optional Allows customization of the resultant SVG.

Return type

Promise <string>

Returns

A promise that resolves to the created SVG string.

fitWorld

WebViewer.fitWorld([duration])
Arguments
  • duration (number()) – optional

Return type

Promise <void>

focusInput

WebViewer.focusInput(focus)

Sets whether keyboard input should be directed to this Web Viewer.

Arguments
  • focus (boolean()) – if true, the Web Viewer will be focused and accept keyboard input, otherwise it will be blurred and not accept keyboard input

Return type

void

getActiveSheetId

WebViewer.getActiveSheetId()
Deprecated

Use SheetManager.getActiveSheetId from sheetManager instead.

Return type

SheetId | null

Returns

gets the id of the current active sheet. null if none has been set.

getAllowHighDPI

WebViewer.getAllowHighDPI()
Deprecated

Use getAllowHighDpi instead.

Return type

boolean

getAllowHighDpi

WebViewer.getAllowHighDpi()

Gets the current value for high DPI rendering

Return type

boolean

Returns

current high DPI setting

getBackgroundSelectionEnabled

WebViewer.getBackgroundSelectionEnabled()

Gets the current state of the background sheet.

Deprecated

Use SheetManager.getBackgroundSelectionEnabled from sheetManager instead.

Return type

boolean

Returns

true if enabled and false otherwise.

getBackgroundSheetEnabled

WebViewer.getBackgroundSheetEnabled()

Gets the current state of the background sheet.

Deprecated

Use SheetManager.getBackgroundSheetEnabled from sheetManager instead.

Return type

boolean

Returns

true if enabled and false otherwise.

getContextMenuStatus

WebViewer.getContextMenuStatus()
Return type

boolean

Returns

boolean true if the context menu is active, false otherwise

getCreationParameters

WebViewer.getCreationParameters()

Gets the parameters that were used to initialize this instance of the WebViewer

Return type

WebViewerConfig()

Returns

initial creation parameters

getCuttingManager

WebViewer.getCuttingManager()
Deprecated

Use cuttingManager instead. Returns the CuttingManager interface which contains methods for creating and interacting with cutting planes and sections.

Return type

CuttingManager()

Returns

Interface containing cutting-related methods.

getExplodeManager

WebViewer.getExplodeManager()
Deprecated

Use explodeManager instead. Returns the model explode interface.

Return type

ExplodeManager()

Returns

Interface containing model explode-related functionality

getFormatVersionString

WebViewer.getFormatVersionString()

Returns the format version string.

Return type

string

Returns

string containing version information for the format.

getLineManager

WebViewer.getLineManager()
Deprecated

Use lineManager instead. Returns the Line interface.

Return type

LineManager()

Returns

Interface containing line-related methods.

getMarkupManager

WebViewer.getMarkupManager()
Deprecated

Use markupManager instead. Returns the markup interface.

Return type

MarkupManager()

Returns

Interface containing markup-related methods.

getMeasureManager

WebViewer.getMeasureManager()
Deprecated

Use measureManager instead. Returns the Measure interface.

Return type

MeasureManager()

Returns

Interface containing measure-related methods.

getMinimumFramerate

WebViewer.getMinimumFramerate()

Gets the minimum framerate that will be maintained by the viewer. The viewer will use various culling techniques in order to maintain the value returned.

Return type

Promise <number>

Returns

Promise that is resolved when the operation has completed.

getModel

WebViewer.getModel()
Deprecated

Use model instead. Returns the model interface.

Return type

Model()

Returns

Interface containing model-related methods.

getOperatorManager

WebViewer.getOperatorManager()
Deprecated

Use operatorManager instead.

Return type

OperatorManager()

getOverlayManager

WebViewer.getOverlayManager()
Deprecated

Use overlayManager instead. Returns the overlay interface.

Return type

OverlayManager()

Returns

Interface containting overlay-related methods

getRendererType

WebViewer.getRendererType()

Gets the RendererType this viewer was created with.

Return type

RendererType

Returns

the render mode.

getSelectionManager

WebViewer.getSelectionManager()
Deprecated

Use selectionManager instead. Returns the selection interface

Return type

SelectionManager()

Returns

Interface containing selection-related methods.

getSheetBackgroundColor

WebViewer.getSheetBackgroundColor()

Gets the sheet Background Color.

Deprecated

Use SheetManager.getSheetBackgroundColor from sheetManager instead.

Return type

Color()

getSheetColor

WebViewer.getSheetColor()

Gets the Sheet Color.

Deprecated

Use SheetManager.getSheetBackgroundColor from sheetManager instead.

Return type

Color()

getSheetIds

WebViewer.getSheetIds()
Deprecated

Use SheetManager.getSheetIds from sheetManager instead.

Return type

[SheetId]

Returns

an array of 2D SheetId

getSheetShadowColor

WebViewer.getSheetShadowColor()

Gets the Sheet Shadow Color.

Deprecated

Use SheetManager.getSheetBackgroundColor from sheetManager instead.

Return type

Color()

getStatistics

WebViewer.getStatistics([calculateTotals])

Gets viewer statistics for the current rendered frame. Statistics marked with a (*) below must be calculated and will not be included in the results unless the calculateTotals parameter is true. The values of these items will be cached and only updated during the next call to this method with calculateTotals set to true.

Arguments
  • calculateTotals (boolean()) – optional Forces an update of the total count elements. Please note that repeatedly calculating these items can cause a performance impact.

Return type

Promise <Object>

Returns

an object containing informational key/value pairs

Statistic Name

Description

draw_call_count

number of draw calls made when rendering the frame

frames_per_second

frames per second estimation

triangle_count

the number of triangles rendered

line_segment_count

the number of line segments rendered

point_count

the number of points rendered

total_element_count(*)

the total number of elements in the scene

total_triangle_count(*)

the total number of triangles in the scene

getStreamCutoffScale

WebViewer.getStreamCutoffScale()

Returns the scale factor that will be applied to the streaming size cutoff. An object whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff. A value of 0 disables the cutoff.

Return type

number

getStreamingMode

WebViewer.getStreamingMode()

Gets the streaming mode this viewer was created with.

Return type

StreamingMode

Returns

the streaming mode.

getView

WebViewer.getView()
Deprecated

Use view instead. Returns the view interface.

Return type

View()

Returns

Interface containing view-related methods.

getViewElement

WebViewer.getViewElement()

Gets the view element for this viewer. This element contains the canvas

Return type

HTMLDivElement

Returns

the view element

getViewerVersionString

WebViewer.getViewerVersionString()

Returns the viewer version string.

Return type

string

Returns

string containing version information for the viewer.

isDrawingSheetActive

WebViewer.isDrawingSheetActive()
Deprecated

Use SheetManager.isDrawingSheetActive from sheetManager instead.

Return type

boolean

Returns

true if a drawing sheet is activated, false otherwise

moveToWindow

WebViewer.moveToWindow(win)

This method should be called when the viewer is being moved to a new window. An example use case would be opening a new pop up window.

Arguments
  • win (Window()) – the new document that this viewer will be associated with.

Return type

void

pauseRendering

WebViewer.pauseRendering([callback])

Pauses rendering updates for the viewer. This function is useful when performing large batches of updates and you would like the result to appear all at once.

Arguments
  • callback (function()) – optional If provided, rendering will be paused, the callback will be called, and then rendering will be resumed once the callback returns or throws an exception.

Return type

DeprecatedPromise()

WebViewer.callback()
Return type

void

redraw

WebViewer.redraw([callback])

Forces the viewer to perform a full redraw.

Arguments
  • callback (function()) – optional A function to be called once the draw is complete. This is provided instead of a Promise to ensure the callback is called before the start of another redraw.

Return type

void

WebViewer.callback()
Return type

void

registerCustomOperator

WebViewer.registerCustomOperator(operator)

Associates a custom operator object with a system generated operatorId.

Arguments
Return type

OperatorId

Returns

an operatorId to be used for this operator.

reset

WebViewer.reset([durationCameraTransition])

Reset the camera, visibility, and transforms to their default state

Arguments
  • durationCameraTransition (number()) – optional

Return type

Promise <void>

Returns

Promise that resolves when the operation has completed.

resetClientTimeout

WebViewer.resetClientTimeout()

Resets the client timeout to the duration set with setClientTimeout.

Return type

void

resizeCanvas

WebViewer.resizeCanvas()

This method should be called after the container element is moved or resized.

Return type

void

resumeRendering

WebViewer.resumeRendering()

Resumes rendering in the viewer.

Return type

DeprecatedPromise()

selectPart

WebViewer.selectPart(nodeId[, selectionMode])

Selects a part with the given Id.

Arguments
  • nodeId (PartId | null) – nodeId of the part to select. Pass null to clear the selection.

  • selectionMode (SelectionMode) – optional

Return type

SelectionType

setActiveSheetId

WebViewer.setActiveSheetId(activeSheetId)

Sets the id of the current active sheet. This method will also isolate and fit the nodes contained in the sheet.

Deprecated

Use SheetManager.setActiveSheetId from sheetManager instead.

Arguments
  • activeSheetId (SheetId) – id of the sheet which will be activated.

Return type

Promise <void>

Returns

promise that resolves when the operation has completed

setAllowHighDPI

WebViewer.setAllowHighDPI(allow)
Deprecated

Use setAllowHighDpi instead.

Arguments
  • allow (boolean()) –

Return type

void

setAllowHighDpi

WebViewer.setAllowHighDpi(allow)

Controls rendering on high DPI displays. If true, the image will be rendered at full resolution when a high-DPI display is detected. If false, the image may be rendered at a lower resolution. The default value is false. This method may be called any time during or after the sceneReady callback has triggered.

Arguments
  • allow (boolean()) – controls the high DPI Setting.

Return type

void

setBackgroundSelectionEnabled

WebViewer.setBackgroundSelectionEnabled(enabled)

Sets whether the background for 2D drawings is selectable. By default it is not. 2D drawings have an invisible selection plane with a single face. Note that this setting is unaffected by the background-sheet enable setting.

Deprecated

Use SheetManager.setBackgroundSelectionEnabled from sheetManager instead.

Arguments
  • enabled (boolean()) –

Return type

Promise <void>

setBackgroundSheetEnabled

WebViewer.setBackgroundSheetEnabled(enabled)
Deprecated

Use SheetManager.setBackgroundSheetEnabled from sheetManager instead. Enables or disables the background sheet used for 2D drawings.

Arguments
  • enabled (boolean()) –

Return type

Promise <void>

setCallbacks

WebViewer.setCallbacks(callbacks)

Registers callbacks that will be called when their corresponding events occur.

Arguments
  • callbacks (CallbackMap()) – object with property names set to corresponding functions to be called when the event occurs.

Return type

void

setClientTimeout

WebViewer.setClientTimeout(timeoutDuration, warningTime)

Sets the parameters for client driven timeout monitoring. If no input is recorded for the the duration, the viewer will disconnect and free server resources. Calling this method will reset any pending timeout duration. No timeout will occur when viewing SCS Files. The default value is to disconnect after 15 minutes, with a warning issued after 14 minutes of inactivity. Please note: Both parameters are required.

Arguments
  • timeoutDuration (number()) – the total time in minutes of inactivity that is allowed before a timeout event occurs

  • warningTime (number()) – the number of minutes before issuing a timeoutWarning event

Return type

boolean

Returns

boolean value indicating whether the timeout values were sucessfully updated

setContextMenuStatus

WebViewer.setContextMenuStatus(isActive)

Sets a boolean with the status of the context menu

Arguments
  • isActive (boolean()) –

Return type

void

setMinimumFramerate

WebViewer.setMinimumFramerate(value)

Sets a minimum frame rate that will be maintained by the viewer. The viewer will use various culling techniques in order to maintain the value passed in.

Passing 0 will cause the entire scene to be drawn for every frame.

Arguments
  • value (number()) – The frame rate for the viewer to maintain.

Return type

DeprecatedPromise()

Returns

Promise that is resolved when the operation has completed.

Passing 0 will cause the entire scene to be drawn for every frame.

setServerRenderQuality

WebViewer.setServerRenderQuality(jpegQualityLow, jpegQualityHigh, scaleLow, scaleHigh)

Sets the image quality settings for the high quality and low quality server side render. The low quality settings will be applied during model interaction (camera changes, selection, etc)

Arguments
  • jpegQualityLow (number()) – The JPEG quality of the low quality render frame

  • jpegQualityHigh (number()) – The JPEG quality of the high quality render frame

  • scaleLow (number()) – The scale factor for the low quality render frame

  • scaleHigh (number()) – The scale factor for the high quality render frame

Return type

void

setSheetColors

WebViewer.setSheetColors(backgroundColor, sheetColor, sheetShadowColor)

Sets custom sheet colors.

Deprecated

Use SheetManager.setSheetColors from sheetManager instead.

Arguments
  • backgroundColor (Color()) – viewer background color.

  • sheetColor (Color()) – sheet background color.

  • sheetShadowColor (Color()) – sheet shadow effect color.

Return type

Promise <void>

setStreamCutoffScale

WebViewer.setStreamCutoffScale(value)

Specifies a scale factor that will be applied to the streaming size cutoff. An object whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.

This value may also be set for file-based sessions. In that case, when loading an SCS file based assembly via XML, projected size will be calculated on a per-file basis using the bounding information provided in the XML. For additional information, refer to Model.loadSubtreeFromXmlBuffer

A value of 0 will disable the cutoff. The value should be in the interval of [0.0, 2.0].

Arguments
  • value (number()) –

Return type

DeprecatedPromise()

This value may also be set for file-based sessions. In that case, when loading an SCS file based assembly via XML, projected size will be calculated on a per-file basis using the bounding information provided in the XML. For additional information, refer to Model.loadSubtreeFromXmlBuffer

A value of 0 will disable the cutoff. The value should be in the interval of [0.0, 2.0].

setViewOrientation

WebViewer.setViewOrientation(orientation[, duration])

Sets the orientation of the current model view.

Arguments
  • orientation (ViewOrientation) – a ViewOrientation object specifying back, front, top, etc.

  • duration (number()) – optional the time in milliseconds for the model to transition to the new view orientation.

Return type

Promise <void>

shutdown

WebViewer.shutdown()

Releases the resources used by the viewer. This method should be called when the viewer is no longer needed but the page is not being reloaded.

Return type

void

start

WebViewer.start()

Starts the viewer and begins the loading process

Return type

boolean

startSheetComparison

WebViewer.startSheetComparison(sheetId1, sheetId2[, config])

Enables a visual comparison of two drawing sheets. The nodes specified by sheetId1 are filled with one color, the nodes specified by sheetId2 with another color, and overlapping areas are filled with a third color.

See endSheetComparison View.startComparison

Deprecated

Use SheetManager.startComparison from sheetManager instead.

Arguments
  • sheetId1 (SheetId) – the drawing sheet to compare against sheetId2

  • sheetId2 (SheetId) – the drawing sheet to compare against sheetId1

  • config (ComparisonConfig()) – optional settings controlling the behavior of the comparison

Return type

Promise <void>

See endSheetComparison View.startComparison

takeSnapshot

WebViewer.takeSnapshot([config])

Creates an Image of the current canvas

Arguments
Return type

Promise <HTMLImageElement>

trigger

WebViewer.trigger(name, id, filename)
Arguments
  • name ('bcfLoaded'()) –

  • id (number()) –

  • filename (BCFName) –

Return type

void

WebViewer.trigger(name, id)
Arguments
  • name ('bcfRemoved'()) –

  • id (number()) –

Return type

void

WebViewer.trigger(name, eventType, nodeIds, initialMatrices, newMatrices)
Arguments
Return type

void

WebViewer.trigger(name, eventType, nodeIds, initialMatrices, newMatrices)
Arguments
Return type

void

WebViewer.trigger(name, eventType, nodeIds, initialMatrices)
Arguments
Return type

void

WebViewer.trigger(name, cuttingSection, planeIndex)
Arguments
  • name ('cuttingPlaneDragStart'()) –

  • cuttingSection (CuttingSection()) –

  • planeIndex (number()) –

Return type

void

WebViewer.trigger(name, cuttingSection, planeIndex)
Arguments
  • name ('cuttingPlaneDrag'()) –

  • cuttingSection (CuttingSection()) –

  • planeIndex (number()) –

Return type

void

WebViewer.trigger(name, cuttingSection, planeIndex)
Arguments
  • name ('cuttingPlaneDragEnd'()) –

  • cuttingSection (CuttingSection()) –

  • planeIndex (number()) –

Return type

void

WebViewer.trigger(name)
Arguments
  • name ('cuttingSectionsLoaded'()) –

Return type

void

WebViewer.trigger(name, redlineMarkup)
Arguments
  • name ('redlineCreated'()) –

  • redlineMarkup (RedlineItem()) –

Return type

void

WebViewer.trigger(name, redlineMarkup)
Arguments
  • name ('redlineDeleted'()) –

  • redlineMarkup (RedlineItem()) –

Return type

void

WebViewer.trigger(name, redlineMarkup)
Arguments
  • name ('redlineUpdated'()) –

  • redlineMarkup (RedlineItem()) –

Return type

void

WebViewer.trigger(name)
Arguments
  • name ('measurementBegin'()) –

Return type

void

WebViewer.trigger(name, measurement)
Arguments
Return type

void

WebViewer.trigger(name, measurement)
Arguments
Return type

void

WebViewer.trigger(name, measurement)
Arguments
Return type

void

WebViewer.trigger(name, measurement)
Arguments
Return type

void

WebViewer.trigger(name, measurement)
Arguments
Return type

void

WebViewer.trigger(name, noteText)
Arguments
  • name ('noteTextCreated'()) –

  • noteText (NoteText()) –

Return type

void

WebViewer.trigger(name, noteText)
Arguments
  • name ('noteTextHidden'()) –

  • noteText (NoteText()) –

Return type

void

WebViewer.trigger(name, noteText)
Arguments
  • name ('noteTextShown'()) –

  • noteText (NoteText()) –

Return type

void

WebViewer.trigger(name)
Arguments
  • name ('walkOperatorActivated'()) –

Return type

void

WebViewer.trigger(name)
Arguments
  • name ('walkOperatorDeactivated'()) –

Return type

void

WebViewer.trigger(name, view)
Arguments
Return type

void

WebViewer.trigger(name, view)
Arguments
Return type

void

WebViewer.trigger(name, view)
Arguments
Return type

void

WebViewer.trigger(name, position, modifiers)
Arguments
Return type

void

WebViewer.trigger(name)
Arguments
  • name ('beginInteraction'()) –

Return type

void

WebViewer.trigger(name)
Arguments
  • name ('endInteraction'()) –

Return type

void

triggerEvent

WebViewer.triggerEvent(eventName[, args])

Triggers a web viewer event

Deprecated

Use trigger instead

Arguments
  • eventName (string()) – the name of the event to trigger

  • args ([any]()) – optional

Return type

void

unregisterCustomOperator

WebViewer.unregisterCustomOperator(operatorId)

Removes a previously registered custom operator from the system.

Arguments
  • operatorId (OperatorId) – the ID of the operator that is to be unregistered

Return type

void

unsetCallbacks

WebViewer.unsetCallbacks(callbacks)

Unregisters callbacks from the system. Note the actual function object passed in must be the same as the one that was registered using setCallbacks.

Arguments
  • callbacks (CallbackMap()) – object with property names set to corresponding functions to be unregistered.

Return type

void

waitForIdle

WebViewer.waitForIdle([config])

Returns a Promise that will resolve after streaming and associated asynchronous operations complete and the scene is fully drawn.

Arguments
  • config (function()) – optional

Return type

Promise <void>