Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtk 9.4.0 fails #208

Closed
germa89 opened this issue Dec 11, 2024 · 5 comments · Fixed by #209
Closed

vtk 9.4.0 fails #208

germa89 opened this issue Dec 11, 2024 · 5 comments · Fixed by #209
Assignees
Labels
bug Something isn't working

Comments

@germa89
Copy link
Contributor

germa89 commented Dec 11, 2024

Attempted in ansys/pymapdl#3602

The traceback is:

/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/mapdl/core/plotting/visualizer.py:231: AttributeError
____________ Test_plastic_solve.test_plot_nodal_plastic_eqv_strain _____________

mapdl = <ansys.mapdl.core.mapdl_grpc.MapdlGrpc object at 0x7f7c82814910>
resume = None

    @staticmethod
    @requires("ansys-tools-visualization_interface")
    def test_plot_nodal_plastic_eqv_strain(mapdl, resume):
>       assert (
            mapdl.post_processing.plot_nodal_plastic_eqv_strain(smooth_shading=True)
            is None
        )

tests/test_post.py:843: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/mapdl/core/post.py:3195: in plot_nodal_plastic_eqv_strain
    return self._plot_point_scalars(
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/mapdl/core/misc.py:435: in wrapper
    return function(self, *args, **kwargs)
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/mapdl/core/post.py:635: in _plot_point_scalars
    return pl.show(**kwargs)
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/mapdl/core/plotting/visualizer.py:842: in show
    self._backend.show()
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/tools/visualization_interface/backends/pyvista/pyvista.py:436: in show
    self.enable_widgets()
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/tools/visualization_interface/backends/pyvista/pyvista.py:186: in enable_widgets
    self._widgets.append(MeshSliderWidget(self))
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/ansys/tools/visualization_interface/backends/pyvista/widgets/mesh_slider.py:55: in __init__
    self._meshes = self.plotter_helper._pl.scene.meshes
/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/pyvista/plotting/plotter.py:7162: in meshes
    return [actor.mapper.dataset for actor in self.actors.values() if hasattr(actor, 'mapper')]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <dict_valueiterator object at 0x7f7c780f4d10>

>   return [actor.mapper.dataset for actor in self.actors.values() if hasattr(actor, 'mapper')]
E   AttributeError: 'NoneType' object has no attribute 'dataset'
@germa89
Copy link
Contributor Author

germa89 commented Dec 11, 2024

Actually, this should be fixed in ansys-tools-visualization-interface

@germa89 germa89 transferred this issue from ansys/pymapdl Dec 11, 2024
@germa89
Copy link
Contributor Author

germa89 commented Dec 11, 2024

I have the feeling that ansys-tools-visualization-interface (from now on, ever, I will refer to it as the VI or ATVI) is injecting some actors in the plot that do not have datasets. I didn't know this was possible.

@germa89
Copy link
Contributor Author

germa89 commented Dec 11, 2024

I have the feeling that ansys-tools-visualization-interface (from now on, ever, I will refer to it as the VI or ATVI) is injecting some actors in the plot that do not have datasets. I didn't know this was possible.

As I suspected, there are the following objects:

> /Users/german.ayuso/Other_projects/ansys-tools-visualization-interface/src/ansys/tools/visualization_interface/backends/pyvista/widgets/mesh_slider.py(59)__init__()
-> self._mb = None
(Pdb) actors = self.plotter_helper._pl.scene.actors
(Pdb) actors
{'PolyData(Addr=0x12a7e3ed0)': Actor (0x17e5f2f20)
  Center:                     (0.45175, 0.05, 0.0)
  Pickable:                   True
  Position:                   (0.0, 0.0, 0.0)
  Scale:                      (1.0, 1.0, 1.0)
  Visible:                    True
  X Bounds                    0.000E+00, 9.035E-01
  Y Bounds                    0.000E+00, 1.000E-01
  Z Bounds                    0.000E+00, 0.000E+00
  User matrix:                Identity
  Has mapper:                 True

Property (0x17e7bfbe0)
  Ambient:                     0.0
  Ambient color:               Color(name='white', hex='#ffffffff', opacity=255)
  Anisotropy:                  0.0
  Color:                       Color(name='white', hex='#ffffffff', opacity=255)
  Culling:                     "none"
  Diffuse:                     1.0
  Diffuse color:               Color(name='white', hex='#ffffffff', opacity=255)
  Edge color:                  Color(name='black', hex='#000000ff', opacity=255)
  Edge opacity:                1.0
  Interpolation:               0
  Lighting:                    True
  Line width:                  1.0
  Metallic:                    0.0
  Opacity:                     1.0
  Point size:                  5.0
  Render lines as tubes:       False
  Render points as spheres:    True
  Roughness:                   0.5
  Show edges:                  False
  Specular:                    0.0
  Specular color:              Color(name='white', hex='#ffffffff', opacity=255)
  Specular power:              100.0
  Style:                       "Surface"

DataSetMapper (0x17e5f2ec0)
  Scalar visibility:           True
  Scalar range:                (0.0, 0.004800000227987766)
  Interpolate before mapping:  True
  Scalar map mode:             point
  Color mode:                  map

Attached dataset:
PolyData (0x17e5f1b40)
  N Cells:    4
  N Points:   8
  N Strips:   0
  X Bounds:   0.000e+00, 9.035e-01
  Y Bounds:   0.000e+00, 1.000e-01
  Z Bounds:   0.000e+00, 0.000e+00
  N Arrays:   11, 'Addr=0x12a7effe0': <vtkmodules.vtkRenderingAnnotation.vtkScalarBarActor(0x12a7effe0) at 0x17e5f2fe0>}
(Pdb) type(actors)
<class 'dict'>
(Pdb) len(actors)
2
(Pdb) actors.keys()
dict_keys(['PolyData(Addr=0x12a7e3ed0)', 'Addr=0x12a7effe0'])
(Pdb) assert actors[list(actors.keys())[0]].mapper.dataset
(Pdb) assert actors[list(actors.keys())[1]].mapper.dataset
*** AttributeError: 'vtkmodules.vtkRenderingAnnotation.vtkScalarBarActo' object has no attribute 'mapper'
(Pdb) hasattr(actors[list(actors.keys())[1]], "mapper")
False
(Pdb) type(actors[list(actors.keys())[1]])
<class 'vtkmodules.vtkRenderingAnnotation.vtkScalarBarActor'>

There are two objects, one is a polydata object (fine) and another one is an scalar bar actor and does not have this data.

@germa89
Copy link
Contributor Author

germa89 commented Dec 11, 2024

@AlejandroFernandezLuces can you give me some code that plot that kind of vtkScalarBarActor? So I can replicate it in pyvista repo and propose a PR.

@germa89 germa89 self-assigned this Dec 11, 2024
@germa89 germa89 added the bug Something isn't working label Dec 11, 2024
@germa89
Copy link
Contributor Author

germa89 commented Dec 11, 2024

@AlejandroFernandezLuces can you give me some code that plot that kind of vtkScalarBarActor? So I can replicate it in pyvista repo and propose a PR.

Not needed since Pyvista already fixed it. #209 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant