Dear all, I am currently able to visualize correctly in ParaView a .vtp file for each time step of a simulation, and to print a screenshot for each. I want to do that in batch, but I want to keep the same state for each one (view point, filters applied, etc). I Have already saved the state into a .psvm file , and I tried to write a python script which, after being run by pvbatch, will (hopefully) print the screenshots. But, unfortunately, it is not working. I tried to change the filename in the state by processing search and replace, but still is not working. For instance, it keeps working on the first data input only. I use ParaView 3.14.0 in Snow Leopard. The reader stuff (commented) is giving me errors. I am sure this is easy, but I am overwhelmed with the large amount of info about python and paraview with no reference to this issue. Please, please, any advice is greatly welcome, and I am sorry if this has been answered previously (I looked at google and the mailing list). Below is my script, which can also be found at http://pastebin.com/UkDAcnHE .
#!/bin/python import glob, string, os, commands from paraview.simple import * #help(servermanager) # vtp files are inside the local subdir DISPLAY files = (commands.getoutput("ls DISPLAY/data-*.vtp | grep -v contacts")).split() # process each file for filename in files: fullfn = commands.getoutput("ls $PWD/" + filename).replace('/','\/') fn = filename.replace('DISPLAY/', '') #os.system("cp ../dem_git/addons/paraview_state.pvsm tmp.pvsm") os.system("cp ~/Desktop/state.pvsm tmp.pvsm") os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") # replace first intance with full path os.system("sed -i.bck 's/DATA.vtp/" + fullfn + "/1' tmp.pvsm") # replace second intance with full path os.system("sed -i.bck 's/DATA.vtp/" + fn + "/1' tmp.pvsm") # replace third with just the filename path servermanager.LoadState("tmp.pvsm") pm = servermanager.ProxyManager() #reader = pm.GetProxy("sources",fullfn) #reader.FileNames = fullfn #reader.FileNameChanged() #reader.UpdatePipeline() SetActiveView(GetRenderView()) Render() WriteImage(fn + "-image.png") os.system("rm -f tmp.pvsm") #servermanager.Finalize() Best regards / Cordialmente, William-Fernando Oquendo -------------------------- Este correo puede carecer de tildes o eñes debido al teclado.
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview