Skip to content

Conversation

@RobPasMue
Copy link
Member

@RobPasMue RobPasMue commented Apr 21, 2025

Currently, inside PyVista, they have implented an operation when performing the clipping plane that is only allowed for numpy arrays with write access. If you pass in a read-only array, this fails. Passing in a new list will hack it (in the meantime) but this will have to be fixed in PyVista.

Opened PR: pyvista/pyvista#7446

@RobPasMue RobPasMue self-assigned this Apr 21, 2025
@github-actions github-actions bot added the bug Something isn't working label Apr 21, 2025
@AlejandroFernandezLuces AlejandroFernandezLuces enabled auto-merge (squash) April 21, 2025 07:53
@AlejandroFernandezLuces AlejandroFernandezLuces merged commit b24bacc into main Apr 21, 2025
19 checks passed
@AlejandroFernandezLuces AlejandroFernandezLuces deleted the fix/pyvista-read-only-behaviour branch April 21, 2025 07:54
# 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.

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 this pull request may close these issues.

5 participants