def view(self, cam=None): """ Description ----------- Use this method to update the camera to the saved location Parameters ---------- `cam` : vtkRenderingOpenGL2Python.vtkOpenGLCamera, optional - The camera you wish to view/update in the current render view """ if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() orientation = self._getOrientation() position = self._getPosition() focus = self._getFocalPoint() viewup = self._getViewUp() # set the camera position and orientation cam.SetPosition(position) cam.SetViewUp(viewup) cam.SetFocalPoint(focus) RenderAllViews()
def screenShot(self, cam=None, path=os.path.expanduser('~'), basenm='view'): """ Description ----------- Save a screenshot of a single camera view Parameters ---------- `cam` : vtkRenderingOpenGL2Python.vtkOpenGLCamera, optional - The camera you wish to view then save a screenshot `path` : string, optional - The directory you wish to save the screenshot. Defaults to user home directory `basenm` : string, optional - The file basename for the screenshot """ if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() os.chdir(path) self.view(cam=cam) WriteImage("%s.png" % (basenm))
def screenShotViews(views, cam=None, path=os.path.expanduser('~'), basenm='view'): """ Description ----------- Save screenshots of many views/cameras Parameters ---------- `view` : dict or list - some iterable object containg multiple `camera` objects `cam` : vtkRenderingOpenGL2Python.vtkOpenGLCamera, optional - The camera you wish to view then save a screenshot `path` : string, optional - The directory you wish to save the screenshot. Defaults to user home directory `basenm` : string, optional - The file basename for the screenshot """ if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() def _iter(obj): return obj if isinstance(obj, dict) else xrange(len(obj)) os.chdir(path) for v in _iter(views): views[v].view(cam=cam) WriteImage("%s_%s.png" % (basenm, v))
def __init__(self, cam=None): if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() self.orientation = cam.GetOrientation() self.position = cam.GetPosition() self.focus = cam.GetFocalPoint() self.viewup = cam.GetViewUp()
def screenShot(self, cam=None, path=os.path.expanduser('~'), basenm='view'): """Save a screenshot of a single camera view Args: cam (vtkRenderingOpenGL2Python.vtkOpenGLCamera) : The camera you wish to view then save a screenshot path (str) : The directory you wish to save the screenshot. Defaults to user home directory basenm (str) : The file basename for the screenshot """ if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() os.chdir(path) self.view(cam=cam) WriteImage("%s.png" % (basenm))
def __init__(self, cam=None): """ @params: cam : vtkRenderingOpenGL2Python.vtkOpenGLCamera : optional : The camera you wish to update this object to. Totally optional """ if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() self.orientation = cam.GetOrientation() self.position = cam.GetPosition() self.focus = cam.GetFocalPoint() self.viewup = cam.GetViewUp()
def update(self, cam=None): """Updates the camera location to that which is in the currently activated view unless a vtkOpenGLCamera is specified. Args: cam (vtkRenderingOpenGL2Python.vtkOpenGLCamera) : The camera you wish to update this object to. Totally optional """ if cam is None: # This allows use to dynamicly select cameras cam = GetActiveCamera() self.orientation = cam.GetOrientation() self.position = cam.GetPosition() self.focus = cam.GetFocalPoint() self.viewup = cam.GetViewUp()