Plotter#

class ansys.geometry.core.plotting.plotter.Plotter(scene: beartype.typing.Optional[pyvista.Plotter] = None, color_opts: beartype.typing.Optional[beartype.typing.Dict] = None, num_points: int = 100, enable_widgets: bool = True)#

Provides for plotting sketches and bodies.

Parameters:
scenePlotter, default: None

Scene instance for rendering the objects.

color_optsdict, default: None

Dictionary containing the background and top colors.

num_pointsint, default: 100

Number of points to use to render the shapes.

enable_widgets: bool, default: True

Whether to enable widget buttons in the plotter window. Widget buttons must be disabled when using trame for visualization.

Overview#

view_xy

View the scene from the XY plane.

view_xz

View the scene from the XZ plane.

view_yx

View the scene from the YX plane.

view_yz

View the scene from the YZ plane.

view_zx

View the scene from the ZX plane.

view_zy

View the scene from the ZY plane.

plot_frame

Plot a frame in the scene.

plot_plane

Plot a plane in the scene.

plot_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_sketch_polydata

Add sketches to the scene from PyVista polydata.

clip

Clip the passed mesh with a plane.

add_design_point

Add a DesignPoint object to the plotter.

add

Add any type of object to the scene.

add_list

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

show

Show the rendered scene on the screen.

scene

Rendered scene object.

geom_object_actors_map

Mapping between the ~pyvista.Actor and the PyAnsys Geometry objects.

Import detail#

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

Property detail#

property Plotter.scene: pyvista.plotting.plotter.Plotter#

Rendered scene object.

Returns:
Plotter

Rendered scene object.

property Plotter.geom_object_actors_map: beartype.typing.Dict[pyvista.Actor, ansys.geometry.core.plotting.plotting_types.GeomObjectPlot]#

Mapping between the ~pyvista.Actor and the PyAnsys Geometry objects.

Method detail#

Plotter.view_xy() None#

View the scene from the XY plane.

Plotter.view_xz() None#

View the scene from the XZ plane.

Plotter.view_yx() None#

View the scene from the YX plane.

Plotter.view_yz() None#

View the scene from the YZ plane.

Plotter.view_zx() None#

View the scene from the ZX plane.

Plotter.view_zy() None#

View the scene from the ZY plane.

Plotter.plot_frame(frame: ansys.geometry.core.math.frame.Frame, plotting_options: beartype.typing.Optional[beartype.typing.Dict] = 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.

Plotter.plot_plane(plane: ansys.geometry.core.math.plane.Plane, plane_options: beartype.typing.Optional[beartype.typing.Dict] = None, plotting_options: beartype.typing.Optional[beartype.typing.Dict] = 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.

Plotter.plot_sketch(sketch: ansys.geometry.core.sketch.sketch.Sketch, show_plane: bool = False, show_frame: bool = False, **plotting_options: beartype.typing.Optional[beartype.typing.Dict]) 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.

Plotter.add_body_edges(body_plot: ansys.geometry.core.plotting.plotting_types.GeomObjectPlot, **plotting_options: beartype.typing.Optional[dict]) 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:
bodyGeomObjectPlot

Body of which to add the edges.

**plotting_optionsdict, default: None

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

Plotter.add_body(body: ansys.geometry.core.designer.body.Body, merge: beartype.typing.Optional[bool] = False, **plotting_options: beartype.typing.Optional[beartype.typing.Dict]) 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.

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

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.

Returns:
str

Name of the added PyVista actor.

Plotter.add_sketch_polydata(polydata_entries: beartype.typing.List[pyvista.PolyData], **plotting_options) None#

Add sketches to the scene from PyVista polydata.

Parameters:
polydatapyvista.PolyData

Polydata to add.

**plotting_optionsdict, default: None

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

Plotter.clip(mesh: beartype.typing.Union[pyvista.PolyData, pyvista.MultiBlock], plane: ansys.geometry.core.math.plane.Plane = None) beartype.typing.Union[pyvista.PolyData, pyvista.MultiBlock]#

Clip the passed mesh with a plane.

Parameters:
meshUnion[pv.PolyData, pv.MultiBlock]

Mesh you want to clip.

normalstr, optional

Plane you want to use for clipping, by default ā€œxā€. Available options: [ā€œxā€, ā€œ-xā€, ā€œyā€, ā€œ-yā€, ā€œzā€, ā€œ-zā€]

origintuple, optional

Origin point of the plane, by default None

Returns:
Union[pv.PolyData,pv.MultiBlock]

The clipped mesh.

Plotter.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.

Plotter.add(object: beartype.typing.Any, merge_bodies: bool = False, merge_components: bool = False, filter: str = None, **plotting_options) None#

Add 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 that you want to plot.

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.

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.

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.

Plotter.add_list(plotting_list: beartype.typing.List[beartype.typing.Any], merge_bodies: bool = False, merge_components: bool = False, 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.

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.

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.

Plotter.show(show_axes_at_origin: bool = True, show_plane: bool = True, jupyter_backend: beartype.typing.Optional[str] = None, **kwargs: beartype.typing.Optional[beartype.typing.Dict]) None#

Show the rendered scene on the screen.

Parameters:
jupyter_backendstr, default: None

PyVista Jupyter backend.

**kwargsdict, default: None

Plotting keyword arguments. For allowable keyword arguments, see the Plotter.show method.

Notes

For more information on supported Jupyter backends, see Jupyter Notebook Plotting in the PyVista documentation.