I would like to plot result having deformed mesh and undeformed mesh after getting results from PyDPF.
The plot should looks something similar to Mechanical, like below.
from ansys.dpf import core as dpf
from ansys.dpf.core import examples
from ansys.dpf.core.plotter import DpfPlotter
#Here we create a Model and request its mesh
model = dpf.Model(examples.find_msup_transient())
mesh_set = model.metadata.meshed_region
#Then we need to request the displacement for two different time steps
displacement_operator = model.results.displacement()
displacement_set2 = displacement_operator.outputs.fields_container()
displacement_set15 = displacement_operator.outputs.fields_container()
#scaling by 100 factor to see significant difference between deformed and undeformed mesh
scaled_op = dpf.operators.math.scale(
#Creaet a new mesh for undeformed state
mesh_set_undeformed = mesh_set.deep_copy()
#User Dpf plotter for adding deformed results and undeformed mesh
pl = DpfPlotter()
#one can use other arguments from pyvista library as well.
The above script can be referred to plot result with undeformed mesh. The resulting plot look like below:
You can play with transparency of undeformed mesh to make it closer to Mechanical view.