Events

The rhinoartisan-web-3d web component emits the following custom events that you can listen to in order to react to changes and user actions.

📋 Event List

ready

Fired when the viewer is fully initialized and all methods are exposed and ready to use.

Details: None

Example:

const viewer = document.querySelector("rhinoartisan-web-3d");
viewer.addEventListener("ready", () => {
  console.log("Viewer is ready!");
  // Now you can safely call viewer methods
  viewer.zoomExtents();
});

model-loaded

Fired when a 3D model has been successfully loaded.

Details in event.detail:

  • modelUrl (string): URL of the loaded model

  • items (array): List of items/parts of the model with their properties

Example:


selection-changed

Fired when the user selects or deselects an item/part of the 3D model.

Details in event.detail:

  • selectedItems (array): List of currently selected items

  • itemUuid (string): UUID of the item that changed

  • isSelected (boolean): true if selected, false if deselected

Example:


material-changed

Fired when the material of one or more items is changed.

Details in event.detail:

  • uuid (string): UUID of the item whose material changed

  • oldMaterial (string): Name of the previous material

  • newMaterial (string): Name of the new material

Example:


model-load-error

Fired when loading a 3D model fails.

Details in event.detail:

  • modelUrl (string): URL of the model that failed to load

  • error (string): Error message

  • timestamp (number): Error timestamp

Example:


texture-load-error

Fired when loading one or more textures fails.

Details in event.detail:

  • textures (array): List of texture names that failed to load

  • error (string): Error message

  • timestamp (number): Error timestamp

Example:


🎯 Complete Usage

Complete example with all events:


💡 Notes

  • All events are CustomEvent with bubbles: true and composed: true properties

  • Event details are always available in event.detail

  • Events are fired asynchronously (using setTimeout) to avoid blocking the render

  • You can remove listeners using removeEventListener() in the standard way

🔗 See Also

  • API Reference - Available viewer methods

  • Configuration - Configuration options

  • Examples - Usage examples

Last updated

Was this helpful?