API Search || Global Search
API Reference   >   Viewing   >   HOOPS Web Viewer
Communicator.WebViewer

 WebViewer

Constructors

constructor

  • 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.

    Parameters

    • inputParams: WebViewerConfig

      object containing key-value pairs for viewer to set

    Returns WebViewer

Properties

BCFManager

BCFManager: BCFManager

cuttingManager

cuttingManager: CuttingManager

explodeManager

explodeManager: ExplodeManager

lineManager

lineManager: LineManager

markupManager

markupManager: MarkupManager

measureManager

measureManager: MeasureManager

model

model: Model

operatorManager

operatorManager: OperatorManager

overlayManager

overlayManager: OverlayManager

selectionManager

selectionManager: SelectionManager

view

view: View

Methods

_getSheetManager

  • _getSheetManager(): SheetManager
  • Returns SheetManager

closeConnection

  • closeConnection(): void
  • Disconnects the network connection when in CSR mode.

    Returns void

deactivateSheets

  • deactivateSheets(): Promise<void>
  • Deactivate sheets and only display 3D content

    Returns Promise<void>

    promise that resolves when the operation has completed

delayCapping

  • delayCapping(): void
  • Delays capping processing by a fixed time interval.

    Returns void

enableBackgroundSheet    [deprecated]

  • enableBackgroundSheet(enabled: boolean): Promise<void>
  • deprecated

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

    Parameters

    • enabled: boolean

    Returns Promise<void>

endSheetComparison

  • endSheetComparison(): Promise<void>
  • Disables a visual comparison of two drawing sheets enabled by startSheetComparison. The Promise returned by that function should be waited upon before calling endSheetComparison.

    Returns Promise<void>

exportToSvg

  • exportToSvg(config?: SvgConfig): Promise<string>
  • Exports the current scene to a two-dimensional SVG representation.

    Parameters

    • Optional config: SvgConfig

      Allows customization of the resultant SVG.

    Returns Promise<string>

    A promise that resolves to the created SVG string.

fitWorld

  • fitWorld(duration?: number): Promise<void>
  • Parameters

    • Optional duration: number

    Returns Promise<void>

focusInput

  • focusInput(focus: boolean): void
  • Sets whether keyboard input should be directed to this Web Viewer.

    Parameters

    • focus: boolean

      if true, the Web Viewer will be focused and accept keyboard input, otherwise it will be blurred and not accept keyboard input

    Returns void

getActiveSheetId

  • getActiveSheetId(): SheetId | null
  • Returns SheetId | null

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

getAllowHighDPI    [deprecated]

  • getAllowHighDPI(): boolean

getAllowHighDpi

  • getAllowHighDpi(): boolean
  • Gets the current value for high DPI rendering

    Returns boolean

    current high DPI setting

getBackgroundSelectionEnabled

  • getBackgroundSelectionEnabled(): boolean
  • Gets the current state of the background sheet.

    Returns boolean

    true if enabled and false otherwise.

getBackgroundSheetEnabled

  • getBackgroundSheetEnabled(): boolean
  • Gets the current state of the background sheet.

    Returns boolean

    true if enabled and false otherwise.

getContextMenuStatus

  • getContextMenuStatus(): boolean
  • Returns boolean

    boolean true if the context menu is active, false otherwise

getCreationParameters

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

    Returns WebViewerConfig

    initial creation parameters

getCuttingManager    [deprecated]

  • deprecated

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

    Returns CuttingManager

    Interface containing cutting-related methods.

getExplodeManager    [deprecated]

  • deprecated

    Use explodeManager instead. Returns the model explode interface.

    Returns ExplodeManager

    Interface containing model explode-related functionality

getFormatVersionString

  • getFormatVersionString(): string
  • Returns the format version string.

    Returns string

    string containing version information for the format.

getLineManager    [deprecated]

  • deprecated

    Use lineManager instead. Returns the Line interface.

    Returns LineManager

    Interface containing line-related methods.

getMarkupManager    [deprecated]

  • deprecated

    Use markupManager instead. Returns the markup interface.

    Returns MarkupManager

    Interface containing markup-related methods.

getMeasureManager    [deprecated]

  • deprecated

    Use measureManager instead. Returns the Measure interface.

    Returns MeasureManager

    Interface containing measure-related methods.

getMinimumFramerate

  • getMinimumFramerate(): Promise<number>
  • Gets the minimum framerate that will be maintained by the viewer. The viewer will use varius culling techniques in order to maintain the value returned.

    Returns Promise<number>

    Promise that is resolved when the operation has completed.

getModel    [deprecated]

  • deprecated

    Use model instead. Returns the model interface.

    Returns Model

    Interface containing model-related methods.

getOperatorManager    [deprecated]

getOverlayManager    [deprecated]

  • deprecated

    Use overlayManager instead. Returns the overlay interface.

    Returns OverlayManager

    Interface containting overlay-related methods

getRendererType

  • Gets the RendererType this viewer was created with.

    Returns RendererType

    the render mode.

getSelectionManager    [deprecated]

getSheetBackgroundColor

  • getSheetBackgroundColor(): Color
  • Gets the sheet Background Color.

    Returns Color

getSheetColor

  • Gets the Sheet Color.

    Returns Color

getSheetIds

  • getSheetIds(): SheetId[]
  • Returns SheetId[]

    an array of 2D SheetIds.

getSheetShadowColor

  • getSheetShadowColor(): Color
  • Gets the Sheet Shadow Color.

    Returns Color

getStatistics

  • getStatistics(calculateTotals?: boolean): Promise<Object>
  • 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.

    Parameters

    • Optional calculateTotals: boolean

      Forces an update of the total count elements. Please note that repeatedly calculating these items can cause a performance impact.

    Returns Promise<Object>

    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

  • getStreamCutoffScale(): number
  • 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.

    Returns number

getStreamingMode

  • Gets the streaming mode this viewer was created with.

    Returns StreamingMode

    the streaming mode.

getView    [deprecated]

  • deprecated

    Use view instead. Returns the view interface.

    Returns View

    Interface containing view-related methods.

getViewElement

  • getViewElement(): HTMLDivElement
  • Gets the view element for this viewer. This element contains the canvas

    Returns HTMLDivElement

    the view element

getViewerVersionString

  • getViewerVersionString(): string
  • Returns the viewer version string.

    Returns string

    string containing version information for the viewer.

isDrawingSheetActive

  • isDrawingSheetActive(): boolean
  • Returns boolean

    true if a drawing sheet is activated, false otherwise

moveToWindow

  • moveToWindow(win: Window): void
  • 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.

    Parameters

    • win: Window

      the new document that this viewer will be associated with.

    Returns void

pauseRendering

  • 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.

    Returns DeprecatedPromise

    Promise that is resolved when the operation has completed.

redraw

  • redraw(callback?: function): void
  • Forces the viewer to perform a full redraw.

    Parameters

    • Optional callback: function

      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.

        • (): void
        • Returns void

    Returns void

registerCustomOperator

  • Associates a custom operator object with a system generated operatorId.

    Parameters

    Returns OperatorId

    an operatorId to be used for this operator.

reset

  • reset(durationCameraTransition?: number): Promise<void>
  • Reset the camera, visibility, and transforms to their default state

    Parameters

    • Optional durationCameraTransition: number

    Returns Promise<void>

    Promise that resolves when the operation has completed.

resetClientTimeout

  • resetClientTimeout(): void
  • Resets the client timeout to the duration set with setClientTimeout.

    Returns void

resizeCanvas

  • resizeCanvas(): void
  • This method should be called after the container element is moved or resized.

    Returns void

resumeRendering

selectPart

  • Selects a part with the given Id.

    Parameters

    • nodeId: PartId | null

      nodeId of the part to select. Pass null to clear the selection.

    • Optional selectionMode: SelectionMode

    Returns SelectionType

setActiveSheetId

  • setActiveSheetId(activeSheetId: SheetId): Promise<void>
  • Sets the id of the current active sheet

    Parameters

    Returns Promise<void>

    promise that resolves when the operation has completed

setAllowHighDPI    [deprecated]

  • setAllowHighDPI(allow: boolean): void
  • deprecated

    Use setAllowHighDpi instead.

    Parameters

    • allow: boolean

    Returns void

setAllowHighDpi

  • setAllowHighDpi(allow: boolean): void
  • 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.

    Parameters

    • allow: boolean

      controls the high DPI Setting.

    Returns void

setBackgroundSelectionEnabled

  • setBackgroundSelectionEnabled(enabled: boolean): Promise<void>
  • 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.

    Parameters

    • enabled: boolean

    Returns Promise<void>

setBackgroundSheetEnabled

  • setBackgroundSheetEnabled(enabled: boolean): Promise<void>
  • Enables or disables the background sheet used for 2D drawings.

    Parameters

    • enabled: boolean

    Returns Promise<void>

setCallbacks

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

    Parameters

    • callbacks: CallbackMap

      object with property names set to corresponding functions to be called when the event occurs.

    Returns void

setClientTimeout

  • setClientTimeout(timeoutDuration: number, warningTime: number): boolean
  • 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.

    Parameters

    • 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

    Returns boolean

    boolean value indicating whether the timeout values were sucessfully updated

setContextMenuStatus

  • setContextMenuStatus(isActive: boolean): void
  • Sets a boolean with the status of the context menu

    Parameters

    • isActive: boolean

    Returns void

setMinimumFramerate

  • 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.

    Parameters

    • value: number

      The frame rate for the viewer to maintain.

    Returns DeprecatedPromise

    Promise that is resolved when the operation has completed.

setServerRenderQuality

  • setServerRenderQuality(jpegQualityLow: number, jpegQualityHigh: number, scaleLow: number, scaleHigh: number): void
  • 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)

    Parameters

    • 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

    Returns void

setSheetColors

  • setSheetColors(backgroundColor: Color, sheetColor: Color, sheetShadowColor: Color): Promise<void>
  • Sets custom sheet colors.

    Parameters

    Returns Promise<void>

setStreamCutoffScale

  • 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. A value of 0 disables the cutoff.

    Parameters

    • value: number

    Returns DeprecatedPromise

setViewOrientation

  • setViewOrientation(orientation: ViewOrientation, duration?: number): Promise<void>
  • Sets the orientation of the current model view.

    Parameters

    • orientation: ViewOrientation

      a ViewOrientation object specifying back, front, top, etc.

    • Optional duration: number

      the time in milliseconds for the model to transition to the new view orientation.

    Returns Promise<void>

shutdown

  • shutdown(): void
  • 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.

    Returns void

start

  • start(): boolean
  • Starts the viewer and begins the loading process

    Returns boolean

startSheetComparison

  • 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.

    Parameters

    • sheetId1: SheetId

      the drawing sheet to compare against sheetId2

    • sheetId2: SheetId

      the drawing sheet to compare against sheetId1

    • Optional config: ComparisonConfig

      settings controlling the behavior of the comparison

    Returns Promise<void>

takeSnapshot

  • Creates an Image of the current canvas

    Parameters

    Returns Promise<HTMLImageElement>

trigger

  • trigger(name: "bcfLoaded", id: number, filename: BCFName): void
  • trigger(name: "bcfRemoved", id: number): void
  • trigger(name: "handleEvent", eventType: HandleEventType, nodeIds: NodeId[], initialMatrices: Matrix[], newMatrices: Matrix[]): void
  • trigger(name: "handleEventEnd", eventType: HandleEventType, nodeIds: NodeId[], initialMatrices: Matrix[], newMatrices: Matrix[]): void
  • trigger(name: "handleEventStart", eventType: HandleEventType, nodeIds: NodeId[], initialMatrices: Matrix[]): void
  • trigger(name: "cuttingPlaneDragStart", cuttingSection: CuttingSection, planeIndex: number): void
  • trigger(name: "cuttingPlaneDrag", cuttingSection: CuttingSection, planeIndex: number): void
  • trigger(name: "cuttingPlaneDragEnd", cuttingSection: CuttingSection, planeIndex: number): void
  • trigger(name: "redlineCreated", redlineMarkup: RedlineItem): void
  • trigger(name: "redlineDeleted", redlineMarkup: RedlineItem): void
  • trigger(name: "redlineUpdated", redlineMarkup: RedlineItem): void
  • trigger(name: "measurementBegin"): void
  • trigger(name: "measurementCreated", measurement: MeasureMarkup): void
  • trigger(name: "measurementDeleted", measurement: MeasureMarkup): void
  • trigger(name: "measurementValueSet", measurement: MeasureMarkup): void
  • trigger(name: "contextMenu", position: Point2, modifiers: KeyModifiers): void
  • trigger(name: "beginInteraction"): void
  • trigger(name: "endInteraction"): void
  • Parameters

    • name: "bcfLoaded"
    • id: number
    • filename: BCFName

    Returns void

  • Parameters

    • name: "bcfRemoved"
    • id: number

    Returns void

  • Parameters

    • name: "handleEvent"
    • eventType: HandleEventType
    • nodeIds: NodeId[]
    • initialMatrices: Matrix[]
    • newMatrices: Matrix[]

    Returns void

  • Parameters

    • name: "handleEventEnd"
    • eventType: HandleEventType
    • nodeIds: NodeId[]
    • initialMatrices: Matrix[]
    • newMatrices: Matrix[]

    Returns void

  • Parameters

    • name: "handleEventStart"
    • eventType: HandleEventType
    • nodeIds: NodeId[]
    • initialMatrices: Matrix[]

    Returns void

  • Parameters

    • name: "cuttingPlaneDragStart"
    • cuttingSection: CuttingSection
    • planeIndex: number

    Returns void

  • Parameters

    • name: "cuttingPlaneDrag"
    • cuttingSection: CuttingSection
    • planeIndex: number

    Returns void

  • Parameters

    • name: "cuttingPlaneDragEnd"
    • cuttingSection: CuttingSection
    • planeIndex: number

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • name: "measurementBegin"

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • name: "beginInteraction"

    Returns void

  • Parameters

    • name: "endInteraction"

    Returns void

triggerEvent    [deprecated]

  • triggerEvent(eventName: string, args?: any[]): void
  • Triggers a web viewer event

    deprecated

    Use trigger instead

    Parameters

    • eventName: string

      the name of the event to trigger

    • Optional args: any[]

    Returns void

unregisterCustomOperator

  • unregisterCustomOperator(operatorId: OperatorId): void
  • Removes a previously registered custom operator from the system.

    Parameters

    • operatorId: OperatorId

      the ID of the operator that is to be unregistered

    Returns void

unsetCallbacks

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

    Parameters

    • callbacks: CallbackMap

      object with property names set to corresponding functions to be unregistered.

    Returns void

waitForIdle

  • waitForIdle(): Promise<void>
  • Returns a Promise that will resolve after streaming and associated asynchronous operations complete and the scene is fully drawn.

    Returns Promise<void>