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-viewerAttributes
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.wasmfiles.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 addedhwvAssemblyTreeReady
Emitted when the assembly tree is readyhwvBcfLoaded
Emitted when a BCF file is loadedhwvBcfRemoved
Emitted when a BCF file is removedhwvBeginInteraction
Emitted when user interaction beginshwvCadViewCreated
Emitted when a CAD view is createdhwvCamera
Emitted when camera position changeshwvCappingIdle
Emitted when capping becomes idlehwvConfigurationActivated
Emitted when a configuration is activatedhwvContextMenu
Emitted when context menu is requestedhwvCuttingPlaneDrag
Emitted during cutting plane draghwvCuttingPlaneDragEnd
Emitted when cutting plane drag endshwvCuttingPlaneDragStart
Emitted when cutting plane drag startshwvCuttingSectionsLoaded
Emitted when cutting sections are loadedhwvEndInteraction
Emitted when user interaction endshwvExplode
Emitted when explode state changeshwvFirstModelLoaded
Emitted when the first model is loadedhwvFrameDrawn
Emitted when a frame is drawnhwvHandleEvent
Emitted during a handle eventhwvHandleEventEnd
Emitted when a handle event endshwvHandleEventStart
Emitted when a handle event startshwvHwfParseComplete
Emitted when HWF parsing is completehwvIncrementalSelectionBatchBegin
Emitted when incremental selection batch beginshwvIncrementalSelectionBatchEnd
Emitted when incremental selection batch endshwvIncrementalSelectionEnd
Emitted when incremental selection endshwvInfo
Emitted with informational messageshwvLineCreated
Emitted when a line markup is createdhwvLineDeleted
Emitted when a line markup is deletedhwvLineLoaded
Emitted when a line markup is loadedhwvMeasurementBegin
Emitted when measurement beginshwvMeasurementCreated
Emitted when a measurement is createdhwvMeasurementDeleted
Emitted when a measurement is deletedhwvMeasurementHidden
Emitted when a measurement is hiddenhwvMeasurementLoaded
Emitted when a measurement is loadedhwvMeasurementShown
Emitted when a measurement is shownhwvMeasurementValueSet
Emitted when a measurement value is sethwvMissingModel
Emitted when a model is missinghwvModelLoadBegin
Emitted when model loading beginshwvModelLoadFailure
Emitted when model loading failshwvModelStructureHeaderParsed
Emitted when model structure header is parsedhwvModelStructureReady
Emitted when the model structure is loadedhwvModelSwitched
Emitted when the model is switchedhwvModelSwitchStart
Emitted when model switching startshwvNoteTextCreated
Emitted when a note text is createdhwvNoteTextDeleted
Emitted when a note text is deletedhwvNoteTextHidden
Emitted when a note text is hiddenhwvNoteTextShown
Emitted when a note text is shownhwvNoteTextUpdated
Emitted when a note text is updatedhwvOverlayViewportSet
Emitted when overlay viewport is sethwvReady
Emitted when the web viewer is initialized and readyhwvRedlineCreated
Emitted when a redline is createdhwvRedlineDeleted
Emitted when a redline is deletedhwvRedlineUpdated
Emitted when a redline is updatedhwvRemoveCuttingSection
Emitted when a cutting section is removedhwvSceneReady
Emitted when the scene is readyhwvSelectionArray
Emitted when selection changeshwvSheetActivated
Emitted when a sheet is activatedhwvSheetDeactivated
Emitted when a sheet is deactivatedhwvStreamingActivated
Emitted when streaming is activatedhwvStreamingDeactivated
Emitted when streaming is deactivatedhwvSubtreeDeleted
Emitted when a subtree is deletedhwvSubtreeLoaded
Emitted when a subtree is loadedhwvTimeout
Emitted on session timeouthwvTimeoutWarning
Emitted before session timeouthwvTransitionBegin
Emitted when a transition beginshwvTransitionEnd
Emitted when a transition endshwvViewAxes
Emitted when view axes changehwvViewCreated
Emitted when a view is createdhwvViewDeactivated
Emitted when a view is deactivatedhwvViewDeleted
Emitted when a view is deletedhwvViewLoaded
Emitted when a view is loadedhwvViewOrientation
Emitted when view orientation changeshwvVisibilityChanged
Emitted when visibility changeshwvWalkOperatorActivated
Emitted when walk operator is activatedhwvWalkOperatorDeactivated
Emitted when walk operator is deactivatedhwvWebGlContextLost
Emitted when WebGL context is losthwvWebsocketConnectionClosed
Emitted when websocket connection closeshwvXHRonerror
Emitted on XHR errorhwvXHRonloadend
Emitted when XHR load endshwvXHRonprogress
Emitted on XHR progressSince
2025.8.0Index
Properties
stylescalculateDefaultViewAxescontainerdisableAutomaticBackgroundSheetsdisableAutomaticFitWorlddisableAutomaticFloorplanOverlayemptyenableShatteredModelUiViewsusePointerEventsboundingPreviewModecontextManagerdefaultMeshLeveldefaultMetallicFactordefaultRoughnessFactorendpointUrienginePathmemoryLimitmodelrendererTypesessionTokenstreamCutoffScalestreamingMode
Accessors
Properties
-
wvc.WebViewerComponent.styles static
styles: CSSResult[]Array of styles to apply to the element. The styles should be defined using the
csstag 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’ ornonce-<base64-value>with<base64-value>replaced be a server-generated nonce.To provide a nonce to use on generated
<style>elements, setwindow.litNonceto 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: BoundingPreviewModeSpecifies what types of bounding previews should be rendered. Any invalid value will be converted to
StreamingMode.Default.
-
wvc.WebViewerComponent.contextManager optional
contextManager:WebViewerContextManagerContext manager for coordinating component communication. Automatically injected when the component is within a context manager.
-
wvc.WebViewerComponent.defaultMeshLevel optional
defaultMeshLevel: numberSpecifies which mesh detail level will be used to initially stream the model.
-
wvc.WebViewerComponent.defaultMetallicFactor optional
defaultMetallicFactor: numberSets 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: numberSets 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: stringSpecifies the endpoint to be used by the viewer. This can be of type: http, https or ws.
-
wvc.WebViewerComponent.enginePath optional
enginePath: stringPath containing the graphics engine
.wasmfiles. Follows the same rules as thesrcattribute of an HTMLscripttag.
-
wvc.WebViewerComponent.memoryLimit optional
memoryLimit: numberControls the amount of mesh data present on the client machine at given time. This value is expressed in Mebibytes.
-
wvc.WebViewerComponent.model optional
model: stringSpecifies the instance name to be loaded. This option is required if you specify an enpdointUri of type
ws://orwss://.
-
wvc.WebViewerComponent.rendererType optional
rendererType: RendererTypeSpecifies the renderer type to be used. Any invalid value will be converted to
RendererType.Client.
-
wvc.WebViewerComponent.sessionToken optional
sessionToken: stringAn 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: numberSpecifies 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: StreamingModeSets 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