Difference between revisions of "ParaView/Python/Screenshot"

From KitwarePublic
Jump to: navigation, search
(New page: <source lang="python"> #!/usr/bin/pvpython from paraview.simple import * import time #read a vtp reader = XMLPolyDataReader(FileName="input.vtp") #position camera view = GetActiveView(...)
 
(2 intermediate revisions by 2 users not shown)
Line 23: Line 23:
  
 
#set image size
 
#set image size
view.RenderWindowSize = [200, 300] #[width, height]
+
view.ViewSize = [200, 300] #[width, height]
  
 
dp = GetDisplayProperties()
 
dp = GetDisplayProperties()
Line 44: Line 44:
 
WriteImage("test.png")
 
WriteImage("test.png")
 
</source>
 
</source>
 +
 +
{{ParaView/Template/Footer}}

Revision as of 09:02, 5 January 2011

#!/usr/bin/pvpython
 
from paraview.simple import *
 
import time
 
#read a vtp
reader = XMLPolyDataReader(FileName="input.vtp")
 
#position camera
view = GetActiveView()
view.CameraViewUp = [0, 0, 1]
view.CameraFocalPoint = [0, 0, 0]
view.CameraViewAngle = 45
view.CameraPosition = [5,0,0]
 
#draw the object
Show()
 
#set the background color
view.Background = [1,1,1]  #white
 
#set image size
view.ViewSize = [200, 300] #[width, height]
 
dp = GetDisplayProperties()
 
#set point color
dp.AmbientColor = [1, 0, 0] #red
 
#set surface color
dp.DiffuseColor = [0, 1, 0] #blue
 
#set point size
dp.PointSize = 2
 
#set representation
dp.Representation = "Surface"
 
Render()
 
#save screenshot
WriteImage("test.png")



ParaView: [Welcome | Site Map]