Skip to content

Commit

Permalink
fixed plot vectors (#4570)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
  • Loading branch information
maxcapodi78 authored Apr 22, 2024
1 parent bbacd60 commit 75a12a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyaedt/generic/general_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def deprecate_kwargs(func_name, kwargs, aliases):
msg += "{} is deprecated, use {} instead.".format(alias, new)
raise TypeError(msg)
pyaedt_logger.warning(
'`{}` is deprecated as an argument to `{}`; use" f" `{}` instead.'.format(alias, func_name, new)
"Argument `{}` is deprecated for method `{}`; use `{}` instead.".format(alias, func_name, new)
)
kwargs[new] = kwargs.pop(alias)

Expand Down
19 changes: 18 additions & 1 deletion pyaedt/generic/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,24 @@ def _read_mesh_files(self, read_frames=False):
if ".case" in field.path:
reader = pv.get_reader(os.path.abspath(field.path)).read()
field._cached_polydata = reader[reader.keys()[0]].extract_surface()
field.scalar_name = field._cached_polydata.point_data.active_scalars_name

if (
hasattr(field._cached_polydata.point_data, "active_vectors")
and field._cached_polydata.point_data.active_vectors_name
):
field.scalar_name = field._cached_polydata.point_data.active_scalars_name
vector_scale = (max(field._cached_polydata.bounds) - min(field._cached_polydata.bounds)) / (
10
* (
np.vstack(field._cached_polydata.active_vectors).max()
- np.vstack(field._cached_polydata.active_vectors).min()
)
)
field._cached_polydata["vectors"] = field._cached_polydata.active_vectors * vector_scale

field.is_vector = True
else:
field.scalar_name = field._cached_polydata.point_data.active_scalars_name

elif ".aedtplt" in field.path:
vertices, faces, scalars, log1 = _parse_aedtplt(field.path)
Expand Down

0 comments on commit 75a12a3

Please sign in to comment.