PlotterHelper#

class ansys.geometry.core.plotting.plotter_helper.PlotterHelper(use_trame: beartype.typing.Optional[bool] = None, allow_picking: beartype.typing.Optional[bool] = False)#

Provides for simplifying the selection of trame in plot() functions.

Parameters:
use_tramebool, default: None

Whether to enable the use of trame. The default is None, in which case the USE_TRAME global setting is used.

allow_picking: bool, default: False

Enables/disables the picking capabilities in the PyVista plotter.

Overview#

enable_widgets

Enable the widgets for the plotter.

select_object

Select an object in the plotter.

unselect_object

Unselect an object in the plotter.

picker_callback

Define callback for the element picker.

compute_edge_object_map

Compute the mapping between plotter actors and EdgePlot objects.

enable_picking

Enable picking capabilities in the plotter.

disable_picking

Disable picking capabilities in the plotter.

add

Add a pyansys-geometry or PyVista object to the plotter.

plot

Plot and show any PyAnsys Geometry object.

show_plotter

Show the plotter or start the trame service.

Import detail#

from ansys.geometry.core.plotting.plotter_helper import PlotterHelper

Method detail#

PlotterHelper.enable_widgets()#

Enable the widgets for the plotter.

PlotterHelper.select_object(geom_object: beartype.typing.Union[ansys.geometry.core.plotting.plotting_types.GeomObjectPlot, ansys.geometry.core.plotting.plotting_types.EdgePlot], pt: numpy.ndarray) None#

Select an object in the plotter.

Highlights the object edges and adds a label with the object name and adds it to the PyAnsys Geometry object selection.

Parameters:
geom_objectUnion[GeomObjectPlot, EdgePlot]

Geometry object to select.

ptndarray

Set of points to determine the label position.

PlotterHelper.unselect_object(geom_object: beartype.typing.Union[ansys.geometry.core.plotting.plotting_types.GeomObjectPlot, ansys.geometry.core.plotting.plotting_types.EdgePlot]) None#

Unselect an object in the plotter.

Removes edge highlighting and label from a plotter actor and removes it from the PyAnsys Geometry object selection.

Parameters:
geom_objectUnion[GeomObjectPlot, EdgePlot]

Object to unselect.

PlotterHelper.picker_callback(actor: pyvista.Actor) None#

Define callback for the element picker.

Parameters:
actorActor

Actor that we are picking.

PlotterHelper.compute_edge_object_map() beartype.typing.Dict[pyvista.Actor, ansys.geometry.core.plotting.plotting_types.EdgePlot]#

Compute the mapping between plotter actors and EdgePlot objects.

Returns:
Dict[Actor, EdgePlot]

Mapping between plotter actors and EdgePlot objects.

PlotterHelper.enable_picking()#

Enable picking capabilities in the plotter.

PlotterHelper.disable_picking()#

Disable picking capabilities in the plotter.

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

Add a pyansys-geometry or PyVista object to the plotter.

Parameters:
objectAny

Object or list of objects you want to show.

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 this component into a single dataset. When True, all the individual bodies are effectively combined into a single dataset without any hierarchy.

**plotting_optionsdict, default: None

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

PlotterHelper.plot(object: beartype.typing.Any = None, screenshot: beartype.typing.Optional[str] = None, merge_bodies: bool = False, merge_component: bool = False, view_2d: beartype.typing.Dict = None, filter: str = None, **plotting_options) beartype.typing.List[beartype.typing.Any]#

Plot and show any PyAnsys Geometry object.

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

Parameters:
objectAny, default: None

Any object or list of objects that you want to plot.

screenshotstr, default: None

Path for saving a screenshot of the image that is being represented.

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 this component into a single dataset. When True, all the individual bodies are effectively combined into a single dataset without any hierarchy.

view_2dDict, default: None

Dictionary with the plane and the viewup vectors of the 2D plane.

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.

Returns:
List[Any]

List with the picked bodies in the picked order.

PlotterHelper.show_plotter(screenshot: beartype.typing.Optional[str] = None) None#

Show the plotter or start the trame service.

Parameters:
plotterPlotter

PyAnsys Geometry plotter with the meshes added.

screenshotstr, default: None

Path for saving a screenshot of the image that is being represented.