Search code examples
pythonparaview

How can i make camera commands of paraview take effect simultaneously


Good evening, I have a script that rotates the camera in paraview. It looks like this.

camera.Elevation(45)  
camera.Roll(90) 
Render()

The thing is, changing the order of the commands changes the final orientation as the camera rotates the second command starting from the already rotated position. Is there a way to make both commands take effect at the same time? Thank you for any suggestions


Solution

  • Given a vtkCamera object, there is a method ApplyTransform which will allow you to apply a vtkTransform object to your camera.

    vtkTransform objects have many more methods for transforms than the simple ones exposed in the vtkCamera interface. You can even use multiple transform objects to build up a transform system. If you have a transformation matrix for the camera already, you can pass it to the vtkTransform object with the SetMatrix method.

    https://www.vtk.org/doc/nightly/html/classvtkTransform.html