GeometryPlotter#

class ansys.geometry.core.plotting.plotter.GeometryPlotter(use_trame: bool | None = None, use_service_colors: bool | None = None, allow_picking: bool = False, show_plane: bool = True)#

Bases: ansys.tools.visualization_interface.Plotter

Plotter for PyAnsys Geometry objects.

This class is an implementation of the PlotterInterface class.

Parameters:
use_tramebool, optional

Whether to use trame visualizer or not, by default None.

use_service_colorsbool, optional

Whether to use service colors or not, by default None.

allow_pickingbool, optional

Whether to allow picking or not, by default False.

show_planebool, optional

Whether to show the plane in the scene, by default True.

Overview#

add_frame

Plot a frame in the scene.

add_plane

Plot a plane in the scene.

add_sketch

Plot a sketch in the scene.

add_body_edges

Add the outer edges of a body to the plot.

add_body

Add a body to the scene.

add_component

Add a component to the scene.

add_component_by_body

Add a component on a per body basis.

add_sketch_polydata

Add sketches to the scene from PyVista polydata.

add_design_point

Add a DesignPoint object to the plotter.

plot_iter

Add a list of any type of object to the scene.

plot

Add a custom mesh to the plotter.

show

Show the plotter.

use_service_colors

Indicates whether to use service colors for plotting purposes.

Import detail#

from ansys.geometry.core.plotting.plotter import GeometryPlotter

Property detail#

property GeometryPlotter.use_service_colors: bool#

Indicates whether to use service colors for plotting purposes.

Method detail#

GeometryPlotter.add_frame(frame: ansys.geometry.core.math.frame.Frame, plotting_options: dict | None = None) None#

Plot a frame in the scene.

Parameters:
frameFrame

Frame to render in the scene.

plotting_optionsdict, default: None

dictionary containing parameters accepted by the pyvista.create_axes_marker() class for customizing the frame rendering in the scene.

GeometryPlotter.add_plane(plane: ansys.geometry.core.math.plane.Plane, plane_options: dict | None = None, plotting_options: dict | None = None) None#

Plot a plane in the scene.

Parameters:
planePlane

Plane to render in the scene.

plane_optionsdict, default: None

dictionary containing parameters accepted by the pyvista.Plane function for customizing the mesh representing the plane.

plotting_optionsdict, default: None

dictionary containing parameters accepted by the Plotter.add_mesh method for customizing the mesh rendering of the plane.

GeometryPlotter.add_sketch(sketch: ansys.geometry.core.sketch.sketch.Sketch, show_plane: bool = False, show_frame: bool = False, **plotting_options: dict | None) None#

Plot a sketch in the scene.

Parameters:
sketchSketch

Sketch to render in the scene.

show_planebool, default: False

Whether to render the sketch plane in the scene.

show_framebool, default: False

Whether to show the frame in the scene.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

GeometryPlotter.add_body_edges(body_plot: ansys.tools.visualization_interface.MeshObjectPlot, **plotting_options: dict | None) None#

Add the outer edges of a body to the plot.

This method has the side effect of adding the edges to the GeomObject that you pass through the parameters.

Parameters:
body_plotMeshObjectPlot

Body of which to add the edges.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

GeometryPlotter.add_body(body: ansys.geometry.core.designer.body.Body, merge: bool = False, **plotting_options: dict | None) None#

Add a body to the scene.

Parameters:
bodyBody

Body to add.

mergebool, default: False

Whether to merge the body into a single mesh. When True, the individual faces of the tessellation are merged. This preserves the number of triangles and only merges the topology.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

GeometryPlotter.add_component(component: ansys.geometry.core.designer.component.Component, merge_component: bool = False, merge_bodies: bool = False, **plotting_options) None#

Add a component to the scene.

Parameters:
componentComponent

Component to add.

merge_componentbool, default: False

Whether to merge the component into a single dataset. When True, all the individual bodies are effectively combined into a single dataset without any hierarchy.

merge_bodiesbool, default: False

Whether to merge each body into a single dataset. When True, all the faces of each individual body are effectively combined into a single dataset without separating faces.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

GeometryPlotter.add_component_by_body(component: ansys.geometry.core.designer.component.Component, merge_bodies: bool, **plotting_options: dict | None) None#

Add a component on a per body basis.

Parameters:
componentComponent

Component to add.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

Notes

This will allow to make use of the service colors. At the same time, it will be slower than the add_component method.

GeometryPlotter.add_sketch_polydata(polydata_entries: list[pyvista.PolyData], sketch: ansys.geometry.core.sketch.sketch.Sketch = None, **plotting_options) None#

Add sketches to the scene from PyVista polydata.

Parameters:
polydata_entrieslist[pyvista.PolyData]

Polydata to add.

sketchSketch, default: None

Sketch to add.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

GeometryPlotter.add_design_point(design_point: ansys.geometry.core.designer.designpoint.DesignPoint, **plotting_options) None#

Add a DesignPoint object to the plotter.

Parameters:
design_pointDesignPoint

DesignPoint to add.

GeometryPlotter.plot_iter(plotting_list: list[Any], name_filter: str = None, **plotting_options) None#

Add a list of any type of object to the scene.

These types of objects are supported: Body, Component, list[pv.PolyData], pv.MultiBlock, and Sketch.

Parameters:
plotting_listlist[Any]

list of objects you want to plot.

name_filterstr, default: None

Regular expression with the desired name or names you want to include in the plotter.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, see the Plotter.add_mesh method.

GeometryPlotter.plot(plottable_object: Any, name_filter: str = None, **plotting_options) None#

Add a custom mesh to the plotter.

Parameters:
plottable_objectstr, default: None

Regular expression with the desired name or names you want to include in the plotter.

name_filter: str, default: None

Regular expression with the desired name or names you want to include in the plotter.

**plotting_optionsdict, default: None

Keyword arguments. For allowable keyword arguments, depend of the backend implementation you are using.

GeometryPlotter.show(plotting_object: Any = None, screenshot: str | None = None, **plotting_options) None | list[Any]#

Show the plotter.

Parameters:
plotting_objectAny, default: None

Object you can add to the plotter.

screenshotstr, default: None

Path to save a screenshot of the plotter.

**plotting_optionsdict, default: None

Keyword arguments for the plotter. Arguments depend of the backend implementation you are using.