API

class SimExporter.core.exporter.Exporter(animation: bool = False, fps: float = 25.0)[source]
__init__(animation: bool = False, fps: float = 25.0)[source]

Main API to create a scene with 3D objects and export a standalone 3D plot or animation in an HTML file.

Parameters:
  • animation – If False, a static 3D plot is exported. If True, a 3D animation is exported if time series are associated to a 3D object.

  • fps – Frame rate of the animation (not used if animation = False).

to_html(filename: str, background_color: str | List = 'white', grid_visible: bool = True, menu_visible: bool = True, frame_visible: bool = True) None[source]

Export the current scene in a standalone HTML file.

Parameters:
  • filename – Name of the HTML file.

  • background_color – Color of the background in the 3D view.

  • grid_visible – If True, the reference grid is displayed.

  • menu_visible – If True, the menu panel is displayed.

  • frame_visible – If True, the reference frame is displayed.

class SimExporter.core.factory.Factory(plt: Plot, animation: bool)[source]
add_arrows(positions: ndarray, vectors: ndarray, color: str | List = 'green', scale: float = 1.0, head_size: float = 1.0, line_width: float = 0.02, time_positions: ndarray | None = None, time_vectors: ndarray | None = None) None[source]

Create a new Vectors object.

Parameters:
  • positions – Positions of the vectors bases.

  • vectors – Vectors values.

  • color – Color of the vectors, either the ‘color name’ or the [R, G, B] values.

  • scale – Scale to apply on the vectors.

  • head_size – Size of the head of the vectors.

  • line_width – Width of the vectors.

  • time_positions – Time series array for the positions.

  • time_vectors – Time series array for the vectors values.

add_k3d_objects(*objs) None[source]

Add standard k3d objects to the scene.

Parameters:

objs – k3d objects.

add_mesh(positions: ndarray, cells: ndarray, color: str | List = 'chartreuse', alpha: float = 1.0, wireframe: bool = False, flat_shading: bool = True, colormap_name: str = 'jet', colormap_range: List[int] | None = None, colormap_values: ndarray | None = None, time_positions: ndarray | None = None, time_colormap_values: ndarray | None = None) None[source]

Create a new Mesh object.

Parameters:
  • positions – Positions of the mesh.

  • cells – Faces of the mesh.

  • color – Color of the mesh, either the ‘color name’ or the [R, G, B] values.

  • alpha – Opacity of the mesh.

  • wireframe – If True, the mesh has a wireframe representation.

  • flat_shading – If True, the faces are rendered flat, otherwise they are smoothed.

  • colormap_name – Color map scheme name, see https://matplotlib.org/stable/users/explain/colors/colormaps.html#classes-of-colormaps.

  • colormap_range – Range of the color map.

  • colormap_values – Scalar values to color the mesh regarding the color map.

  • time_positions – Time series array for the positions.

  • time_colormap_values – Time series array for the color map scalar values.

add_points(positions: ndarray, color: str | List = 'salmon', alpha: float = 1.0, point_size: int = 0.1, colormap_name: str = 'jet', colormap_range: List[int] | None = None, colormap_values: ndarray | None = None, time_positions: ndarray | None = None, time_colormap_values: ndarray | None = None) None[source]

Create a new Points object.

Parameters:
  • positions – Positions of the points.

  • color – Color of the points, either the ‘color name’ or the [R, G, B] values.

  • alpha – Opacity of the points.

  • point_size – Size of the points.

  • colormap_name – Color map scheme name, see https://matplotlib.org/stable/users/explain/colors/colormaps.html#classes-of-colormaps.

  • colormap_range – Range of the color map.

  • colormap_values – Scalar values to color the points regarding the color map.

  • time_positions – Times series array for the positions.

  • time_colormap_values – Time series array for the color map scalar values.