[Paraview] Python camera script
Robert Maynard
thorin.hax at gmail.com
Wed Aug 8 11:32:20 EDT 2007
The included script is designed to allow the user to manipulate the camera
position, the first test I wrote
was the ability to reset the camera to positive X, negative Y etc. The
problem is that the changes to the camera
position are not updating untill I actually manually focus the render
window. I presume the problem is that I am
not updating a key component. Can anybody tell me what one I am missing?
#!/usr/bin/env python
import paraview
#camera is an already defined class
class Cam:
def PosX(self):
Cam.__Reset(self,1, 0, 0, 0, 0, 1)
def NegX(self):
Cam.__Reset(self,-1, 0, 0, 0, 0, 1)
def PosY(self):
Cam.__Reset(self,0, 1, 0, 0, 0, 1)
def NegY(self):
Cam.__Reset(self,0, -1, 0, 0, 0, 1)
def PosZ(self):
Cam.__Reset(self,0, 0, 1, 0, 1, 0);
def NegZ(self):
Cam.__Reset(self,0, 0, -1, 0, 1, 0);
#Private Methods
def __Reset(self,look_x, look_y, look_z,up_x,up_y,up_z):
pxm = paraview.pyProxyManager()
iter = pxm.group_iter("view_modules")
activeView = None
for proxy in iter:
if proxy.IsA("vtkSMRenderModuleProxy"):
activeView = proxy
break
if activeView:
activeView.SetCameraPosition(0, 0, 0);
activeView.SetCameraFocalPoint(look_x,look_y,look_z)
activeView.SetCameraViewUp(up_x,up_y,up_z)
activeView.ResetCamera()
activeView.UpdateVTKObjects()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/paraview/attachments/20070808/f0e24fec/attachment.htm
More information about the ParaView
mailing list