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.

Properties

wvc.WebViewerComponent.styles

static

styles: CSSResult[]

Array of styles to apply to the element. The styles should be defined using the ? 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.

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.

wvc.WebViewerComponent.disableAutomaticFitWorld
disableAutomaticFitWorld: boolean

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

wvc.WebViewerComponent.disableAutomaticFloorplanOverlay
disableAutomaticFloorplanOverlay: boolean

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

wvc.WebViewerComponent.empty
empty: boolean

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

wvc.WebViewerComponent.enableShatteredModelUiViews
enableShatteredModelUiViews: boolean

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

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.

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