Advertisement
Guest User

Screenshot from paraview

a guest
Apr 21st, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. #!/bin/python
  2. import glob, string, os, commands
  3. from paraview.simple import *
  4.  
  5. #help(servermanager)
  6. # vtp files are inside the local subdir DISPLAY
  7. files = (commands.getoutput("ls DISPLAY/data-*.vtp | grep -v contacts")).split()
  8.  
  9. # process each file
  10. for filename in files:
  11.     fullfn = commands.getoutput("ls $PWD/" + filename).replace('/','\/')
  12.     fn = filename.replace('DISPLAY/', '')
  13.     #os.system("cp ../dem_git/addons/paraview_state.pvsm tmp.pvsm")
  14.     os.system("cp ~/Desktop/state.pvsm tmp.pvsm")
  15.     os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") # replace first intance with full path
  16.     os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") # replace second intance with full path
  17.     os.system("sed -i.bck 's/DATA.vtp/" + fn + "/1' tmp.pvsm") # replace third with just the filename path
  18.     servermanager.LoadState("tmp.pvsm")
  19.     pm = servermanager.ProxyManager()
  20.     #reader = pm.GetProxy("sources",fullfn)
  21.     #reader.FileNames = fullfn
  22.     #reader.FileNameChanged()
  23.     #reader.UpdatePipeline()
  24.     SetActiveView(GetRenderView())
  25.     Render()
  26.     WriteImage(fn + "-image.png")
  27.     os.system("rm -f tmp.pvsm")
  28.     #servermanager.Finalize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement