I’m a beginner to paraview python development.
I have loaded a 3D grid model using a custom reader. When the model is loaded in paraview the mouse interaction is totally different than when I load the same model in pvpython.
I would like to have the same behavior of paraview mouse interaction done in pvpython which is:
Left Mouse + (Left or Right) → rotate around Z-Axis.
Left Mouse + (Up or Down) → rotate around X-Axis.
Left Mouse + Shift + (Left or Right) → rotate around Y-Axis.
Right Mouse + (Up or Down) → Zoom In/Out.
Right Mouse + Shift → Translate in the direction of the mouse movement.
Any idea how can I do that?
Welcome to the ParaView community, @qasimta.
You can customize mouse bindings in the settings. Edit menu → Settings, Camera tab.
Thank you Cory for the information.
I wanted to do that programmatically using python and I got the code on how to do it from the tracer.
However, when I inspected these setting in both paraview and in pvpython they are identical.
[‘Rotate’, ‘Pan’, ‘Zoom’, ‘Roll’, ‘Rotate’, ‘Pan’, ‘Zoom’, ‘Rotate’, ‘ZoomToMouse’]
but still the behavior is different. for example, the Rotate action in paraview will rotate the model while the model is still in the viewing window, while in pvpython generated window when the model is rotated it goes out of the viewing window.
I suspected that it has to do with the CenterOfRotation settings, and I tried setting it to the same value of the CameraFocalPoint. It became better but still not the same as what I see in paraview window. It looks like the rotation is happening around the center of the model. If so, how can I get the values of the center of the model.
s.GetDataInformation().GetBounds() gives you the bounding box around your data where
s is your data source.
Thank you very much for the help. I did set the CenterOfRotation to the center of the model. It didn’t work but I realized later that I was scaling the object in the Z direction so I had to multiply the z location with the same scaling factor. Finally, it worked.
Thanks again for the help.
I just wonder, are there any documentations for python APIs.