PyVistaInterface
#
- class ansys.tools.visualization_interface.backends.pyvista.pyvista_interface.PyVistaInterface(scene: pyvista.Plotter | None = None, color_opts: Dict | None = None, num_points: int = 100, enable_widgets: bool = True, show_plane: bool = False, use_qt: bool = False, **plotter_kwargs)#
Provides the middle class between PyVista plotting operations and PyAnsys objects.
The main purpose of this class is to simplify interaction between PyVista and the PyVista backend provided. This class is responsible for creating the PyVista scene and adding the PyAnsys objects to it.
- Parameters:
- scene
Plotter
, default:None
Scene for rendering the objects. If passed,
off_screen
needs to be set manually beforehand for documentation and testing.- color_opts
dict
, default:None
Dictionary containing the background and top colors.
- num_points
int
, default: 100 Number of points to use to render the shapes.
- enable_widgetsbool, default:
True
Whether to enable widget buttons in the plotter window. Widget buttons must be disabled when using trame for visualization.
- show_planebool, default:
False
Whether to show the XY plane in the plotter window.
- use_qtbool, default:
False
Whether to use the Qt backend for the plotter window.
- scene
Overview#
View the scene from the XY plane. |
|
View the scene from the XZ plane. |
|
View the scene from the YX plane. |
|
View the scene from the YZ plane. |
|
View the scene from the ZX plane. |
|
View the scene from the ZY plane. |
|
Clip a given mesh with a plane. |
|
Plot a generic |
|
Plot the outer edges of an object to the plot. |
|
Plot any type of object to the scene. |
|
Plot elements of an iterable of any type of objects to the scene. |
|
Show the rendered scene on the screen. |
|
Set the default values for the plotting options. |
Rendered scene object. |
|
Mapping between the PyVista actor and the PyAnsys objects. |
Import detail#
from ansys.tools.visualization_interface.backends.pyvista.pyvista_interface import PyVistaInterface
Property detail#
- property PyVistaInterface.scene: pyvista.plotting.plotter.Plotter#
Rendered scene object.
- Returns:
Plotter
Rendered scene object.
- property PyVistaInterface.object_to_actors_map: Dict[pyvista.Actor, ansys.tools.visualization_interface.types.mesh_object_plot.MeshObjectPlot]#
Mapping between the PyVista actor and the PyAnsys objects.
Method detail#
- PyVistaInterface.clip(mesh: pyvista.PolyData | pyvista.MultiBlock | pyvista.UnstructuredGrid, plane: ansys.tools.visualization_interface.utils.clip_plane.ClipPlane) pyvista.PolyData | pyvista.MultiBlock #
Clip a given mesh with a plane.
- Parameters:
- Returns:
Union
[pv.PolyData,pv.MultiBlock]Clipped mesh.
- PyVistaInterface.plot_meshobject(custom_object: ansys.tools.visualization_interface.types.mesh_object_plot.MeshObjectPlot, **plotting_options)#
Plot a generic
MeshObjectPlot
object to the scene.- Parameters:
- plottable_object
MeshObjectPlot
Object to add to the scene.
- **plotting_options
dict
, default:None
Keyword arguments. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- plottable_object
- PyVistaInterface.plot_edges(custom_object: ansys.tools.visualization_interface.types.mesh_object_plot.MeshObjectPlot, **plotting_options) None #
Plot the outer edges of an object to the plot.
This method has the side effect of adding the edges to the
MeshObjectPlot
object that you pass through the parameters.- Parameters:
- custom_object
MeshObjectPlot
Custom object with the edges to add.
- **plotting_options
dict
, default:None
Keyword arguments. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- custom_object
- PyVistaInterface.plot(plottable_object: pyvista.PolyData | pyvista.MultiBlock | ansys.tools.visualization_interface.types.mesh_object_plot.MeshObjectPlot | pyvista.UnstructuredGrid, name_filter: str = None, **plotting_options) None #
Plot any type of object to the scene.
Supported object types are
List[pv.PolyData]
,MeshObjectPlot
, andpv.MultiBlock
.- Parameters:
- plottable_object
Union
[pv.PolyData
,pv.MultiBlock
,MeshObjectPlot
,pv.UnstructuredGrid
,pv.StructuredGrid
] Object to plot.
- name_filter
str
, default:None
Regular expression with the desired name or names to include in the plotter.
- **plotting_options
dict
, default:None
Keyword arguments. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- plottable_object
- PyVistaInterface.plot_iter(plotting_list: List[Any], name_filter: str = None, **plotting_options) None #
Plot elements of an iterable of any type of objects to the scene.
- Parameters:
- plotting_list
List
[Any
] List of objects to plot.
- name_filter
str
, default:None
Regular expression with the desired name or names to include in the plotter.
- **plotting_options
dict
, default:None
Keyword arguments. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- plotting_list
- PyVistaInterface.show(show_plane: bool = False, jupyter_backend: str | None = None, **kwargs: Dict | None) None #
Show the rendered scene on the screen.
- Parameters:
Notes
For more information on supported Jupyter backends, see Jupyter Notebook Plotting in the PyVista documentation.
- PyVistaInterface.set_add_mesh_defaults(plotting_options: Dict | None) None #
Set the default values for the plotting options.
- Parameters:
- plotting_options
Optional
[Dict
] Keyword arguments. For allowable keyword arguments, see the
Plotter.add_mesh
method.
- plotting_options