routing.core.model#

Temporary module for implementing base class Object3D of objects with 3D representations.

class routing.core.model.Object3D(name: str = '')[source]#

Bases: DessiaObject

A base class for objects with 3D representations.

This class inherits from DessiaObject, and provides a common interface for 3D objects in the routing system, with methods for visualization and CAD export. Subclasses must implement volmdlr_primitives() to provide their 3D geometry.

Parameters:

name – The name to identify this 3D object. Defaults to ‘’.

babylon_data(merge_meshes: bool = True, show_curves: bool = False, ocaf: OCAF | None = None) dict[source]#

Get babylonjs data.

babylonjs(page_name: str | None = None, use_cdn: bool = True, debug: bool = False, merge_meshes: bool = True, show_curves: bool = False, dark_mode: bool = False, ocaf: OCAF | None = None) str[source]#

Generate and display an HTML file to visualize the 3D model using Babylon.js in a web browser.

This method creates a 3D representation of the volume model using the Babylon.js framework. The method allows options for debugging, merging meshes, and toggling dark mode for the visualization. The resulting HTML file can either be a temporary file or a user-specified file.

Parameters:
  • page_name – The name of the HTML file to be generated. If None, a temporary file is created.

  • use_cdn – Flag to use CDN for loading Babylon.js resources. Defaults to True.

  • debug – Enable debugging mode for more detailed console output in the browser. Defaults to False.

  • merge_meshes – Flag to chose to merge all the faces of each shell into a single mesh. Defaults to True. If False, shell are decomposed according to their faces in the Babylon.js scene nodes tree.

  • show_curves – Whether to show shape curves or not.

  • dark_mode – Enable dark mode for the HTML visualization. Defaults to False.

  • ocaf – OCAF document representing current Object3D

Returns:

The file path of the generated HTML file.

cad_view#

Implementation of a tag for displays.

volmdlr_primitives() list[Primitive3D][source]#

Get Primitive3D objects representing the 3D geometry.

This method must be implemented by subclasses to provide their 3D geometric representation.

Returns:

List of Primitive3D objects

Raises:

NotImplementedError – If not implemented by subclass

volume_model() VolumeModel[source]#

Get volume model.

Creates a VolumeModel from the object’s primitives for visualization and CAD operations.

Returns:

VolumeModel containing the object’s primitives