WebViewerComponent

class wvc.WebViewerComponent()

A simple HTML tag to quickly initialize a complete viewer.

This component provides a full-featured 3D model viewer with support for loading models, navigation, selection, markup, and various visualization modes.

Examples

<hoops-web-viewer endpointuri="/models/sample.scs" enginepath="/engine">
</hoops-web-viewer>

<script>
  const viewer = document.getElementsByTagName('hoops-web-viewer')[0];
  viewer.addEventListener('hwvReady', (event) => {
    console.log('Viewer ready:', event.detail);
  });
</script>

Custom Element

hoops-web-viewer

Attributes

endpointuri

Specifies the endpoint to be used by the viewer.

model

Specifies the instance name to be loaded.

sessiontoken

An arbitrary value used for authentication.

renderertype

Specifies the renderer type to be used.

empty

Whether the viewer should be started without connecting to a server or loading a model.

usepointerevents

Specifies whether pointer events should be used when available.

streamingmode

Sets the streaming mode that the viewer will use.

memorylimit

Controls the amount of mesh data present on the client machine at given time.

boundingpreviewmode

Specifies what types of bounding previews should be rendered.

defaultmeshlevel

Specifies which mesh detail level will be used to initially stream the model.

streamcutoffscale

Specifies a scale factor that will be applied to the streaming size cutoff.

disableautomaticbackgroundsheets

If true, then automatic generation of background sheets for drawings is not performed when the drawing is loaded.

disableautomaticfloorplanoverlay

If true, then the floorplan overlay capability will not be displayed automatically for BIM enabled models.

calculatedefaultviewaxes

If true, the default view axes will be calculated from the initial camera unless explicitly set during authoring time.

disableautomaticfitworld

If true, disable automatic fitworld on camera activation when there is no camera on view.

enableshatteredmodeluiviews

If true, then CAD views contained within external models will populate the model tree UI.

enginepath

Path containing the graphics engine .wasm files.

defaultmetallicfactor

Sets a default metallic factor that will be applied to ALL non PBR materials in the scene.

defaultroughnessfactor

Sets a default roughness factor that will be applied to ALL non PBR materials in the scene.

Events

hwvAddCuttingSection

Emitted when a cutting section is added

hwvAssemblyTreeReady

Emitted when the assembly tree is ready

hwvBcfLoaded

Emitted when a BCF file is loaded

hwvBcfRemoved

Emitted when a BCF file is removed

hwvBeginInteraction

Emitted when user interaction begins

hwvCadViewCreated

Emitted when a CAD view is created

hwvCamera

Emitted when camera position changes

hwvCappingIdle

Emitted when capping becomes idle

hwvConfigurationActivated

Emitted when a configuration is activated

hwvContextMenu

Emitted when context menu is requested

hwvCuttingPlaneDrag

Emitted during cutting plane drag

hwvCuttingPlaneDragEnd

Emitted when cutting plane drag ends

hwvCuttingPlaneDragStart

Emitted when cutting plane drag starts

hwvCuttingSectionsLoaded

Emitted when cutting sections are loaded

hwvEndInteraction

Emitted when user interaction ends

hwvExplode

Emitted when explode state changes

hwvFirstModelLoaded

Emitted when the first model is loaded

hwvFrameDrawn

Emitted when a frame is drawn

hwvHandleEvent

Emitted during a handle event

hwvHandleEventEnd

Emitted when a handle event ends

hwvHandleEventStart

Emitted when a handle event starts

hwvHwfParseComplete

Emitted when HWF parsing is complete

hwvIncrementalSelectionBatchBegin

Emitted when incremental selection batch begins

hwvIncrementalSelectionBatchEnd

Emitted when incremental selection batch ends

hwvIncrementalSelectionEnd

Emitted when incremental selection ends

hwvInfo

Emitted with informational messages

hwvLineCreated

Emitted when a line markup is created

hwvLineDeleted

Emitted when a line markup is deleted

hwvLineLoaded

Emitted when a line markup is loaded

hwvMeasurementBegin

Emitted when measurement begins

hwvMeasurementCreated

Emitted when a measurement is created

hwvMeasurementDeleted

Emitted when a measurement is deleted

hwvMeasurementHidden

Emitted when a measurement is hidden

hwvMeasurementLoaded

Emitted when a measurement is loaded

hwvMeasurementShown

Emitted when a measurement is shown

hwvMeasurementValueSet

Emitted when a measurement value is set

hwvMissingModel

Emitted when a model is missing

hwvModelLoadBegin

Emitted when model loading begins

hwvModelLoadFailure

Emitted when model loading fails

hwvModelStructureHeaderParsed

Emitted when model structure header is parsed

hwvModelStructureReady

Emitted when the model structure is loaded

hwvModelSwitched

Emitted when the model is switched

hwvModelSwitchStart

Emitted when model switching starts

hwvNoteTextCreated

Emitted when a note text is created

hwvNoteTextDeleted

Emitted when a note text is deleted

hwvNoteTextHidden

Emitted when a note text is hidden

hwvNoteTextShown

Emitted when a note text is shown

hwvNoteTextUpdated

Emitted when a note text is updated

hwvOverlayViewportSet

Emitted when overlay viewport is set

hwvReady

Emitted when the web viewer is initialized and ready

hwvRedlineCreated

Emitted when a redline is created

hwvRedlineDeleted

Emitted when a redline is deleted

hwvRedlineUpdated

Emitted when a redline is updated

hwvRemoveCuttingSection

Emitted when a cutting section is removed

hwvSceneReady

Emitted when the scene is ready

hwvSelectionArray

Emitted when selection changes

hwvSheetActivated

Emitted when a sheet is activated

hwvSheetDeactivated

Emitted when a sheet is deactivated

hwvStreamingActivated

Emitted when streaming is activated

hwvStreamingDeactivated

Emitted when streaming is deactivated

hwvSubtreeDeleted

Emitted when a subtree is deleted

hwvSubtreeLoaded

Emitted when a subtree is loaded

hwvTimeout

Emitted on session timeout

hwvTimeoutWarning

Emitted before session timeout

hwvTransitionBegin

Emitted when a transition begins

hwvTransitionEnd

Emitted when a transition ends

hwvViewAxes

Emitted when view axes change

hwvViewCreated

Emitted when a view is created

hwvViewDeactivated

Emitted when a view is deactivated

hwvViewDeleted

Emitted when a view is deleted

hwvViewLoaded

Emitted when a view is loaded

hwvViewOrientation

Emitted when view orientation changes

hwvVisibilityChanged

Emitted when visibility changes

hwvWalkOperatorActivated

Emitted when walk operator is activated

hwvWalkOperatorDeactivated

Emitted when walk operator is deactivated

hwvWebGlContextLost

Emitted when WebGL context is lost

hwvWebsocketConnectionClosed

Emitted when websocket connection closes

hwvXHRonerror

Emitted on XHR error

hwvXHRonloadend

Emitted when XHR load ends

hwvXHRonprogress

Emitted on XHR progress

Since

2025.8.0

Properties

wvc.WebViewerComponent.styles

static

styles: CSSResult[]

Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.

Note on Content Security Policy:

Element styles are implemented with <style> tags when the browser doesn’t support adopted StyleSheets. To use such <style> tags with the style-src CSP directive, the style-src value must either include ‘unsafe-inline’ or nonce-<base64-value> with <base64-value> replaced be a server-generated nonce.

To provide a nonce to use on generated <style> elements, set window.litNonce to a server-generated nonce in your page’s HTML, before loading application code:

<script>
  // Generated and unique per request:
  window.litNonce = 'a1b2c3d4';
</script>
wvc.WebViewerComponent.calculateDefaultViewAxes
calculateDefaultViewAxes: boolean

If true, the default view axes will be calculated from the initial camera unless explicitly set during authoring time.

Default

```ts false ```

wvc.WebViewerComponent.container
container: HTMLElement

The DOM container element that hosts the WebViewer canvas. Automatically assigned during component initialization.

wvc.WebViewerComponent.disableAutomaticBackgroundSheets
disableAutomaticBackgroundSheets: boolean

If true, then automatic generation of background sheets for drawings is not performed when the drawing is loaded.

Default

```ts false ```

wvc.WebViewerComponent.disableAutomaticFitWorld
disableAutomaticFitWorld: boolean

If true, disable automatic fitworld on camera activation when there is no camera on view

Default

```ts false ```

wvc.WebViewerComponent.disableAutomaticFloorplanOverlay
disableAutomaticFloorplanOverlay: boolean

If true, then the floorplan overlay capability will not be displayed automatically for BIM enabled models

Default

```ts false ```

wvc.WebViewerComponent.empty
empty: boolean

Whether the viewer should be started without connecting to a server or loading a model.

Default

```ts false ```

wvc.WebViewerComponent.enableShatteredModelUiViews
enableShatteredModelUiViews: boolean

If true, then CAD views contained within external models will populate the model tree UI.

Default

```ts false ```

wvc.WebViewerComponent.usePointerEvents
usePointerEvents: boolean

Specifies whether pointer events should be used when available. Setting this option to false can be useful when using web views in GUI toolkits that rely on Internet Explorer.

Default

```ts false ```

wvc.WebViewerComponent.boundingPreviewMode

optional

boundingPreviewMode: BoundingPreviewMode

Specifies what types of bounding previews should be rendered. Any invalid value will be converted to StreamingMode.Default.

wvc.WebViewerComponent.contextManager

optional

contextManager: WebViewerContextManager

Context manager for coordinating component communication. Automatically injected when the component is within a context manager.

wvc.WebViewerComponent.defaultMeshLevel

optional

defaultMeshLevel: number

Specifies which mesh detail level will be used to initially stream the model.

wvc.WebViewerComponent.defaultMetallicFactor

optional

defaultMetallicFactor: number

Sets a default metallic factor that will be applied to ALL non PBR materials in the scene. Acceptable value range is (0.0 - 1.0) If [[defaultRoughnessFactor]] is specified and this value is omitted, a value of 1.0 will be assumed.

wvc.WebViewerComponent.defaultRoughnessFactor

optional

defaultRoughnessFactor: number

Sets a default roughness factor that will be applied to ALL non PBR materials in the scene. . Acceptable value range is (0.0 - 1.0) If [[defaultMetallicFactor]] is specified and this value is omitted, a value of 1.0 will be assumed.

wvc.WebViewerComponent.endpointUri

optional

endpointUri: string

Specifies the endpoint to be used by the viewer. This can be of type: http, https or ws.

wvc.WebViewerComponent.enginePath

optional

enginePath: string

Path containing the graphics engine .wasm files. Follows the same rules as the src attribute of an HTML script tag.

wvc.WebViewerComponent.memoryLimit

optional

memoryLimit: number

Controls the amount of mesh data present on the client machine at given time. This value is expressed in Mebibytes.

wvc.WebViewerComponent.model

optional

model: string

Specifies the instance name to be loaded. This option is required if you specify an enpdointUri of type ws:// or wss://.

wvc.WebViewerComponent.rendererType

optional

rendererType: RendererType

Specifies the renderer type to be used. Any invalid value will be converted to RendererType.Client.

wvc.WebViewerComponent.sessionToken

optional

sessionToken: string

An arbitrary value used for authentication. If used, it must match the token expected by the server for connection to proceed.

wvc.WebViewerComponent.streamCutoffScale

optional

streamCutoffScale: number

Specifies a scale factor that will be applied to the streaming size cutoff.

In streaming sessions, an object whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.

In file sessions, when loading a tree via XML, a file whose projected size is lower than the cutoff will not be requested until its projected size reaches the cutoff.

A value of 0 will disable the cutoff. The value should be in the interval of [0.0, 2.0]. If unspecified, this value will default to 1.0 for streaming sessions and 0.0 (disabled) for file based sessions.

wvc.WebViewerComponent.streamingMode

optional

streamingMode: StreamingMode

Sets the streaming mode that the viewer will use. Any invalid value will be converted to StreamingMode.Default.

Accessors

wvc.WebViewerComponent.viewer()
get viewer(): (None | WebViewer)

Gets the underlying WebViewer instance. Provides access to the full HOOPS Web Viewer API for advanced operations.

Returns: (None | WebViewer)

The WebViewer instance or null if not initialized