trimesh.viewer.notebook¶
notebook.py¶
Render trimesh.Scene objects in HTML and jupyter and marimo notebooks using three.js
- trimesh.viewer.notebook.in_notebook() Literal['jupyter', 'marimo', False] ¶
Check to see if we are in a Jypyter or Marimo notebook.
- Returns:
Returns the type of notebook we’re in or False if it is running as terminal application.
- Return type:
in_notebook
- trimesh.viewer.notebook.scene_to_html(scene, escape_quotes: bool = False) str ¶
Return HTML that will render the scene using GLTF/GLB encoded to base64 loaded by three.js
- Parameters:
scene (trimesh.Scene) – Source geometry
escape_quotes – If true, replaces quotes ‘”’ with ‘"’ so that the HTML is valid inside a srcdoc property.
- Returns:
html – HTML containing embedded geometry
- Return type:
str
- trimesh.viewer.notebook.scene_to_mo_notebook(scene, height=500, **kwargs)¶
Convert a scene to HTML containing embedded geometry and a three.js viewer that will display nicely in an Marimo notebook.
- Parameters:
scene (trimesh.Scene) – Source geometry
- Returns:
html – Object containing rendered scene
- Return type:
mo.Html
- trimesh.viewer.notebook.scene_to_notebook(scene, height=500, **kwargs)¶
Convert a scene to HTML containing embedded geometry and a three.js viewer that will display nicely in an IPython/Jupyter notebook.
- Parameters:
scene (trimesh.Scene) – Source geometry
- Returns:
html – Object containing rendered scene
- Return type:
IPython.display.HTML