/[escript]/trunk/pyvisi/py_src/scene.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/scene.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1001 by jongui, Tue Feb 13 04:05:13 2007 UTC revision 1002 by jongui, Wed Feb 28 06:51:33 2007 UTC
# Line 179  class Scene: Line 179  class Scene:
179          @type image_name: String          @type image_name: String
180          @param image_name: Name of the saved image.          @param image_name: Name of the saved image.
181          """          """
182                
183          # NOTE: Render and Modified must be called everytime before writing          try:
184          # an image. Otherwise, only the first image will always be saved.              # NOTE: Render and Modified must be called everytime before writing
185          # This is due to the architecture of VTK.              # an image. Otherwise, only the first image will always be saved.
186          self.__vtk_render_window.Render()              # This is due to the architecture of VTK.
187          self.__vtk_window_to_image.Modified()              self.__vtk_render_window.Render()
188                        self.__vtk_window_to_image.Modified()
189          # Retrieve rendered object from the window and convert it into an              
190          # image.              # Retrieve rendered object from the window and convert it into an
191          self.__vtk_image_writer.SetInput(              # image.
192                  self.__vtk_window_to_image.GetOutput())              self.__vtk_image_writer.SetInput(
193          self.__vtk_image_writer.SetFileName(image_name)                      self.__vtk_window_to_image.GetOutput())
194          self.__vtk_image_writer.Write()                  self.__vtk_image_writer.SetFileName(image_name)
195                self.__vtk_image_writer.Write()    
196            except AttributeError:
197                print "Sorry, incorrect use of the '" + self.__renderer + "' renderer. Kindly, switch to the 'offline'  renderer."
198    
199    
200      def animate(self):      def animate(self):
201          """          """
202          Render the object onto the scene on-the-fly. No interaction can occur.          Render the object onto the scene on-the-fly. No interaction can occur.
203          """          """
204    
# Line 205  class Scene: Line 209  class Scene:
209          Render the object onto the scene.          Render the object onto the scene.
210          """          """
211    
212          self.__vtk_render_window.Render()          try:
213                self.__vtk_render_window.Render()
214    
215          # NOTE: Once Start is executed, the driver will not further execute              # NOTE: Once Start is executed, the driver will not further execute
216          # any subsequent codes thereafter.              # any subsequent codes thereafter.
217          self.__vtk_render_window_interactor.Start()              self.__vtk_render_window_interactor.Start()
218            except AttributeError:
219                print "Sorry, incorrect use of the '" + self.__renderer + "' renderer. Kindly, switch to the 'online'  renderer."
220            
221      def _addActor3D(self, viewport, actor):      def _addActor3D(self, viewport, actor):
222          """          """

Legend:
Removed from v.1001  
changed lines
  Added in v.1002

  ViewVC Help
Powered by ViewVC 1.1.26