macro for "Snap View" (like in Siemens NX)

Hello all,

we use Siemens NX as CAD software. In NX there is this function called “Snap View” (with keyboard shortcut F8). I would love to recreate this function in ParaView with a Python macro.

Basically “Snap View” works similar to the toolbar buttons “Set view direction to X/Y/Z”. However, I don’t have to explicitly select the corresponding plane, but “Snap View” automatically rotates to the nearest plane. Here is a screenshot for explanation:

At first the model is positioned arbitrarily. By pressing F8, the model is rotated so that the “nearest” plane is parallel to the view plane. Only rotation around the center of rotation, no zoom and no translation.

The toolbar buttons apparently call “ResetActiveCameraToDirection”:

vtkSMRenderViewProxy::ResetActiveCameraToDirection(
    const double& look_x, const double& look_y, const double& look_z,
    const double& up_x, const double& up_y, const double& up_z
)

I guess I have to set up_x, up_y and up_z to -1, 0 or 1, depending on the orientation.

But where do I get look_x, look_y and look_z from?

Thank you very much for your help!