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
readyFired 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
model-loadedFired when a 3D model has been successfully loaded.
Details in event.detail:
modelUrl(string): URL of the loaded modelitems(array): List of items/parts of the model with their properties
Example:
selection-changed
selection-changedFired when the user selects or deselects an item/part of the 3D model.
Details in event.detail:
selectedItems(array): List of currently selected itemsitemUuid(string): UUID of the item that changedisSelected(boolean):trueif selected,falseif deselected
Example:
material-changed
material-changedFired when the material of one or more items is changed.
Details in event.detail:
uuid(string): UUID of the item whose material changedoldMaterial(string): Name of the previous materialnewMaterial(string): Name of the new material
Example:
model-load-error
model-load-errorFired when loading a 3D model fails.
Details in event.detail:
modelUrl(string): URL of the model that failed to loaderror(string): Error messagetimestamp(number): Error timestamp
Example:
texture-load-error
texture-load-errorFired when loading one or more textures fails.
Details in event.detail:
textures(array): List of texture names that failed to loaderror(string): Error messagetimestamp(number): Error timestamp
Example:
🎯 Complete Usage
Complete example with all events:
💡 Notes
All events are CustomEvent with
bubbles: trueandcomposed: truepropertiesEvent details are always available in
event.detailEvents are fired asynchronously (using
setTimeout) to avoid blocking the renderYou 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?