Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

pv.Property.style does not support RepresentationType #8168

@banesullivan

Description

@banesullivan

Describe the bug, what's wrong, and what you expected.

The RepresentationType should be supported by the Property.style setter but it isn't. It only accepts string values.

This is inconsistent with other enum types like the interpolation which does support our InterpolationType enum

Steps to reproduce the bug.

>>> import pyvista as pv
>>> from pyvista.plotting.opts import InterpolationType, RepresentationType
>>> a = pv.Actor()
>>> a.prop.interpolation
<InterpolationType.FLAT: 0>
>>> a.prop.interpolation = InterpolationType.GOURAUD
>>> a.prop.style
'Surface'
>>> a.prop.style = RepresentationType.WIREFRAME
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/banesullivan/Software/pyvista/pyvista/pyvista/core/utilities/misc.py", line 359, in __setattr__
    object.__setattr__(self, key, value)
  File "/Users/banesullivan/Software/pyvista/pyvista/pyvista/plotting/_property.py", line 300, in style
    new_style = new_style.lower()
                ^^^^^^^^^^^^^^^
AttributeError: 'RepresentationType' object has no attribute 'lower'

Further, the representation property is inherited from upstream VTK but isn't useable either

>>> a.prop.representation
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/banesullivan/Software/pyvista/pyvista/pyvista/core/_vtk_core.py", line 657, in __getattribute__
    DisableVtkSnakeCase.check_attribute(self, item)
  File "/Users/banesullivan/Software/pyvista/pyvista/pyvista/core/_vtk_core.py", line 652, in check_attribute
    raise pv.PyVistaAttributeError(msg)
pyvista.core.errors.PyVistaAttributeError: The attribute 'representation' is defined by VTK and is not part of the PyVista API

System Information

latest main at `0.47.dev0`

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUh-oh! Something isn't working as expected.feature-requestPlease add this cool feature!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions