Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/281.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: pyvista read-only behaviour
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ def clip(
Clipped mesh.
"""
return mesh.clip(normal=plane.normal, origin=plane.origin)
# Make sure to pass new copies/objects to the mesh for the normal
# This should be fixed by PyVista eventually... it is coming from
# https://github.com/pyvista/pyvista/commit/2db1888a294a14e4f28a140d8aa0466d332912dc
return mesh.clip(normal=[elem for elem in plane.normal],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

return mesh.clip(normal=plane.normal.copy(), origin=plane.origin)

or

return mesh.clip(normal=plane.normal[:], origin=plane.origin)

to make the intent clearer?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never mind. Already merged

Copy link
Member Author

@RobPasMue RobPasMue Apr 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ahernsean -- no worries, this should be a temporary fix. See pyvista/pyvista#7446

Nonetheless, we can't just assume "copy()" will exist since the type can be a simple tuple/list (for which the copy() method doesn't exist). Option 2 could be valid but I'd rather fix it in PyVista and remove this hack altogether.

origin=plane.origin)

def plot_meshobject(self, custom_object: MeshObjectPlot, **plotting_options):
"""Plot a generic ``MeshObjectPlot`` object to the scene.
Expand Down
Loading