Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/1257.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: Rename built in shadowing variables
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [
dependencies = [
"ansys-api-geometry==0.4.4",
"ansys-tools-path>=0.3,<1",
"ansys-tools-visualization-interface>=0.2.4,<1",
"ansys-tools-visualization-interface>=0.2.6,<1",
"beartype>=0.11.0,<0.19",
"grpcio>=1.35.0,<2",
"grpcio-health-checking>=1.45.0,<2",
Expand All @@ -50,7 +50,7 @@ all = [
tests = [
"ansys-platform-instancemanagement==1.1.2",
"ansys-tools-path==0.6.0",
"ansys-tools-visualization-interface==0.2.4",
"ansys-tools-visualization-interface==0.2.6",
"beartype==0.18.5",
"docker==7.1.0",
"grpcio==1.64.1",
Expand All @@ -77,7 +77,7 @@ tests-minimal = [
]
doc = [
"ansys-sphinx-theme[autoapi]==0.16.5",
"ansys-tools-visualization-interface==0.2.4",
"ansys-tools-visualization-interface==0.2.6",
"beartype==0.18.5",
"docker==7.1.0",
"ipyvtklink==0.2.3",
Expand Down
48 changes: 26 additions & 22 deletions src/ansys/geometry/core/plotting/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def add_design_point(self, design_point: DesignPoint, **plotting_options) -> Non
def plot_iter(
self,
plotting_list: List[Any],
filter: str = None,
name_filter: str = None,
**plotting_options,
) -> None:
"""
Expand All @@ -314,25 +314,25 @@ def plot_iter(
----------
plotting_list : List[Any]
List of objects you want to plot.
filter : str, default: None
name_filter : str, default: None
Regular expression with the desired name or names you want to include in the plotter.
**plotting_options : dict, default: None
Keyword arguments. For allowable keyword arguments, see the
:meth:`Plotter.add_mesh <pyvista.Plotter.add_mesh>` method.
"""
for object in plotting_list:
_ = self.plot(object, filter, **plotting_options)
_ = self.plot(object, name_filter, **plotting_options)

# Override add function from plotter
def plot(self, object: Any, filter: str = None, **plotting_options) -> None:
def plot(self, plottable_object: Any, name_filter: str = None, **plotting_options) -> None:
"""
Add a custom mesh to the plotter.
Parameters
----------
object : Any
Object to add.
filter : str, default: None
plottable_object : str, 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_options : dict, default: None
Keyword arguments. For allowable keyword arguments, depend of the backend implementation
Expand All @@ -351,24 +351,28 @@ def plot(self, object: Any, filter: str = None, **plotting_options) -> None:
else:
merge_components = None
# Add the custom object to the plotter
if isinstance(object, DesignPoint):
self.add_design_point(object, **plotting_options)
elif isinstance(object, Sketch):
self.add_sketch(object, **plotting_options)
elif isinstance(object, Body) or isinstance(object, MasterBody):
self.add_body(object, merge_bodies, **plotting_options)
elif isinstance(object, Design) or isinstance(object, Component):
self.add_component(object, merge_components, merge_bodies, **plotting_options)
elif isinstance(object, List) and object != [] and isinstance(object[0], pv.PolyData):
self.add_sketch_polydata(object, **plotting_options)
elif isinstance(object, List):
self.plot_iter(object, filter, **plotting_options)
elif isinstance(object, MeshObjectPlot):
if isinstance(plottable_object, DesignPoint):
self.add_design_point(plottable_object, **plotting_options)
elif isinstance(plottable_object, Sketch):
self.add_sketch(plottable_object, **plotting_options)
elif isinstance(plottable_object, Body) or isinstance(object, MasterBody):
self.add_body(plottable_object, merge_bodies, **plotting_options)
elif isinstance(plottable_object, Design) or isinstance(object, Component):
self.add_component(plottable_object, merge_components, merge_bodies, **plotting_options)
elif (
isinstance(plottable_object, List)
and plottable_object != []
and isinstance(plottable_object[0], pv.PolyData)
):
self.add_sketch_polydata(plottable_object, **plotting_options)
elif isinstance(plottable_object, List):
self.plot_iter(plottable_object, name_filter, **plotting_options)
elif isinstance(plottable_object, MeshObjectPlot):
self._backend.pv_interface.set_add_mesh_defaults(plotting_options)
self._backend.pv_interface.plot(object, filter, **plotting_options)
self._backend.pv_interface.plot(plottable_object, name_filter, **plotting_options)
else:
# any left type should be a PyVista object
self._backend.pv_interface.plot(object, filter, **plotting_options)
self._backend.pv_interface.plot(plottable_object, name_filter, **plotting_options)

def show(
self,
Expand Down