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_surface

Add a surface to the scene.

add_curve

Add a curve to the scene.

add_body_edges

Add the outer edges of a body to the plot.

add_body

Add a body to the scene.

add_face

Add a face 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.

add_design_curve

Add a DesignCurve 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.

export_glb

Export the design to a glb file. Does not support picked objects.

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_surface(surface: ansys.geometry.core.shapes.surfaces.Surface, **plotting_options) None#

Add a surface to the scene.

Parameters:
surfaceSurface

Surface to add.

**plotting_optionsdict, default: None

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

GeometryPlotter.add_curve(curve: ansys.geometry.core.shapes.curves.Curve, **plotting_options) None#

Add a curve to the scene.

Parameters:
curveCurve

Curve to add.

**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, exclude_ids: set[str] | None = None, **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_face(face: ansys.geometry.core.designer.face.Face, **plotting_options: dict | None) None#

Add a face to the scene.

Parameters:
faceFace

Face to add.

**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, exclude_ids: set[str] | None = None, **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, exclude_ids: set[str] | None = None, **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.add_design_curve(design_curve: ansys.geometry.core.designer.designcurve.DesignCurve, **plotting_options) None#

Add a DesignCurve object to the plotter.

Parameters:
design_curveDesignCurve

DesignCurve to add.

**plotting_optionsdict, default: None

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

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, highlight: ansys.geometry.core.selection_builder.typed_selection.TypedSelection | None = None, highlight_color: str = '#FF0000', **plotting_options) None#

Add a custom mesh to the plotter.

Parameters:
plottable_objectAny

Object to add to the plotter.

name_filterstr, default: None

Regular expression used to filter plotted objects by name.

highlightTypedSelection, default: None

Selection to highlight on top of the plotted object.

highlight_colorstr, default: “#FF0000”

Color used to highlight the selection.

**plotting_optionsdict, default: None

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

Warning

Highlighting changes the color of the selected objects. Selection items without writable color and id properties are skipped.

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.

GeometryPlotter.export_glb(plotting_object: Any = None, filename: str | pathlib.Path | None = None, **plotting_options) pathlib.Path#

Export the design to a glb file. Does not support picked objects.

Parameters:
plotting_objectAny, default: None

Object you can add to the plotter.

filenamestr | Path, default: None

Path to save a GLB file of the plotter. If None, the file will be saved as temp_glb.glb.

**plotting_optionsdict, default: None

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

Returns:
Path

Path to the exported glb file.