Skip to content

Commit

Permalink
Add as_linear argument to Model.plot()
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi committed Apr 21, 2023
1 parent f24c44b commit af60642
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ansys/dpf/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def __str__(self):
txt += str(self.metadata.time_freq_support)
return txt

def plot(self, color="w", show_edges=True, **kwargs):
def plot(self, color="w", show_edges=True, as_linear=True, **kwargs):
"""Plot the mesh of the model.
Parameters
Expand All @@ -215,6 +215,9 @@ def plot(self, color="w", show_edges=True, **kwargs):
color of the mesh faces in PyVista format. The default is white with ``"w"``.
show_edges : bool
Whether to show the mesh edges. The default is ``True``.
as_linear : bool, optional
Whether to show quadratic elements as their linear equivalents (for faster rendering).
Defaults to ``True``.
**kwargs : optional
Additional keyword arguments for the plotter. For additional keyword
arguments, see ``help(pyvista.plot)``.
Expand All @@ -235,7 +238,12 @@ def plot(self, color="w", show_edges=True, **kwargs):
kwargs["color"] = color
kwargs["show_edges"] = show_edges
pl = DpfPlotter(**kwargs)
pl.add_mesh(self.metadata.meshed_region, show_axes=kwargs.pop("show_axes", True), **kwargs)
pl.add_mesh(
self.metadata.meshed_region,
show_axes=kwargs.pop("show_axes", True),
as_linear=as_linear,
**kwargs
)
return pl.show_figure(**kwargs)

@property
Expand Down

0 comments on commit af60642

Please sign in to comment.