Displayable#
Provides a mixin class for local 3D display using Babylon.js.
- class volmdlr.displayable.Displayable3D#
Bases:
objectMixin class for local 3D display using Babylon.js.
- display_3d(selector: str | None = None, page_name: str | None = None, use_cdn: bool = True, dark_mode: bool = False, **kwargs: Any) str#
Display the 3D model locally in a web browser using Babylon.js.
- Parameters:
selector – The selector of the @cad_view method to use. If None, uses the first one.
page_name – The name of the HTML file to generate. If None, a temp file is created.
use_cdn – Flag to use CDN for loading Babylon.js resources.
dark_mode – Enable dark mode for the visualization.
kwargs – Additional arguments passed to the @cad_view method.
- Returns:
The file path of the generated HTML file.
- save_display_3d_to_file(filename: str, selector: str | None = None, use_cdn: bool = True, dark_mode: bool = False, **kwargs: Any) str#
Save the 3D model display to an HTML file without opening the browser.
- Parameters:
filename – The name of the HTML file to generate.
selector – The selector of the @cad_view method to use. If None, uses the first one.
use_cdn – Flag to use CDN for loading Babylon.js resources.
dark_mode – Enable dark mode for the visualization.
kwargs – Additional arguments passed to the @cad_view method.
- Returns:
The file path of the generated HTML file.
- save_display_3d_to_stream(stream, selector: str | None = None, use_cdn: bool = True, dark_mode: bool = False, **kwargs: Any) None#
Save the 3D display HTML content to a stream.
- Parameters:
stream – The stream to write the HTML content to (StringFile or file-like).
selector – The selector of the @cad_view method to use. If None, uses the first one.
use_cdn – Flag to use CDN for loading Babylon.js resources.
dark_mode – Enable dark mode for the visualization.
kwargs – Additional arguments passed to the @cad_view method.