Skip to content
Draft
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
16 changes: 10 additions & 6 deletions src/ansys/dpf/core/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def plot(
>>> fields_container = disp.outputs.fields_container()
>>> field = fields_container[0]
>>> mesh.plot(field)
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)

Parameters
----------
Expand All @@ -567,19 +567,23 @@ def plot(
Additional keyword arguments for the plotter. For additional keyword
arguments, see ``help(pyvista.plot)``.
"""
from ansys.dpf.core.plotter import Plotter
from ansys.dpf.core.plotter import DpfPlotter

if meshed_region is None:
meshed_region = self.meshed_region
pl = Plotter(meshed_region, **kwargs)
return pl.plot_contour(
show_axes = kwargs.pop("show_axes", True)
pl = DpfPlotter(**kwargs)
pl.add_fields_container(
self,
shell_layers,
meshed_region=meshed_region,
shell_layers=shell_layers,
deform_by=deform_by,
scale_factor=scale_factor,
show_axes=kwargs.pop("show_axes", True),
show_axes=show_axes,
**kwargs,
)
kwargs.pop("notebook", None)
return pl.show_figure(**kwargs)

def resize(self, nentities, datasize):
"""Allocate memory.
Expand Down
16 changes: 10 additions & 6 deletions src/ansys/dpf/core/meshed_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import ansys.dpf.core.errors
from ansys.dpf.core.faces import Faces
from ansys.dpf.core.nodes import Nodes
from ansys.dpf.core.plotter import DpfPlotter, Plotter
from ansys.dpf.core.plotter import DpfPlotter
from ansys.dpf.gate import meshed_region_capi, meshed_region_grpcapi


Expand Down Expand Up @@ -636,19 +636,23 @@ def plot(
>>> disp = model.results.displacement()
>>> field = disp.outputs.fields_container()[0]
>>> model.metadata.meshed_region.plot(field)
(None, <pyvista.plotting.plotter.Plotter ...>)
([], <pyvista.plotting.plotter.Plotter ...>)

"""
if field_or_fields_container is not None:
pl = Plotter(self, **kwargs)
return pl.plot_contour(
show_axes = kwargs.pop("show_axes", True)
pl = DpfPlotter(**kwargs)
pl.add_fields_container(
field_or_fields_container,
shell_layers,
show_axes=kwargs.pop("show_axes", True),
meshed_region=self,
shell_layers=shell_layers,
deform_by=deform_by,
scale_factor=scale_factor,
show_axes=show_axes,
**kwargs,
)
kwargs.pop("notebook", None)
return pl.show_figure(**kwargs)

# otherwise, simply plot the mesh
pl = DpfPlotter(**kwargs)
Expand Down
Loading
Loading