Skip to content

Commit 598f64a

Browse files
MeenaBytesPProfizi
andauthored
fix(animation): fix mesh deformation for mode shape animation (#1696)
Co-authored-by: Rajesh Meena <[email protected]> Co-authored-by: Paul Profizi <[email protected]> Co-authored-by: PProfizi <[email protected]>
1 parent da952fa commit 598f64a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

examples/02-modal_analyses/01-plot_and_animate_modes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,6 @@
7272
# To suppress window pop-up, set the `off_screen` argument to True.
7373
# ~~~~~~~~~~~~~~~~~~~~
7474

75-
animation.animate_mode(disp, mode_number=1, save_as="tmp.gif", off_screen=True)
75+
animation.animate_mode(
76+
disp, mode_number=1, save_as="tmp.gif", off_screen=True, deform_scale_factor=10.0
77+
)

src/ansys/dpf/core/animation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def animate_mode(
120120

121121
wf.set_input_name("weights", scaling_op.inputs.weights)
122122
wf.set_output_name("field", scaling_op.outputs.field)
123+
wf.set_output_name("deform_by", scaling_op.outputs.field)
123124

124125
anim = Animator(workflow=wf, **kwargs)
125126

@@ -130,5 +131,6 @@ def animate_mode(
130131
save_as=save_as,
131132
mode_number=mode_number,
132133
clim=[0, max_data],
134+
scale_factor=deform_scale_factor,
133135
**kwargs,
134136
)

src/ansys/dpf/core/animator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def animate_workflow(
7070
scale_factor = [False] * len(indices)
7171
type_scale = type(scale_factor)
7272
if type_scale in [int, float]:
73-
scale_factor = [scale_factor] * len(indices)
73+
scale_factor = [float(scale_factor)] * len(indices)
7474
elif type_scale == list:
7575
pass
7676
# elif type_scale in [core.field.Field, core.fields_container.FieldsContainer]:
@@ -121,6 +121,7 @@ def render_frame(frame):
121121
self.add_field(
122122
field,
123123
deform_by=deform,
124+
scale_factor=scale_factor[frame],
124125
scale_factor_legend=scale_factor[frame],
125126
shell_layer=shell_layer,
126127
**kwargs,

0 commit comments

Comments
 (0)