[Paraview] small ParaView Script not working

Marco Kokic kokicm at student.ethz.ch
Fri Nov 27 06:55:26 EST 2015


I found the reason for print cells_ None, which is that I used the wrong 
datareader, instead the script should look like this:

#!/usr/bin/pvpython

#setup paraview connection
from paraview.simple import *

cells_ = 
XMLMultiBlockDataReader(FileName=['/home/me/Dokumente/TEST/Cells_0.vtm', 
'/home/me/Dokumente/TEST/Cells_100.vtm', 
'/home/me/Dokumente/TEST/Cells_200.vtm'])

# create a new 'Integrate Variables'
integrateVariables1 = IntegrateVariables(Input=cells_)
# set active source
SetActiveSource(integrateVariables1)
# create a new 'Plot Selection Over Time'
plotSelectionOverTime1 = PlotSelectionOverTime(Input=integrateVariables1)
# save data
SaveData('/home/me/Dokumente/TEST/TEST.csv', proxy=plotSelectionOverTime1)


Still the rest of the script doesn't work. I tried to trace every step 
when using the gui and saved it as a macro. Doesn't work.














Am 26.11.2015 um 20:51 schrieb Marco Kokic:
> Dear ParaViewers,
>
> I have written and tested the following script, which I hope is 
> self-explanatory. It doesn't work though (print cells_ gives "None") 
> and I can't see what I missed. I'm thankful for any suggestions.
>
> #!/usr/bin/pvpython
>
> #setup paraview connection
> from paraview.simple import *
>
> def my_range(start, end, step):
>     while start <= end:
>         yield start
>         start += step
>
> def LoadMultipleFiles(FilePrefix, Low, High):
>     for i in my_range(Low,High+1,100):
>         reader = XMLMultiBlockDataReader(FileName='/path-to-files/' + 
> FilePrefix + str(i) + '.vtm')
>
> cells_ = LoadMultipleFiles('Cells_', 0, 1000)
> print cells_
>
> # create a new 'Integrate Variables'
> #integrateVariables1 = IntegrateVariables(Input=cells_)
> # create a new 'Plot Selection Over Time'
> #plotSelectionOverTime1 = 
> PlotSelectionOverTime(Input=integrateVariables1,Selection=None)
> # save data
> #SaveData('/path-to-files/output10_areaovertime.csv', 
> proxy=plotSelectionOverTime1, 
> Precision=5,UseScientificNotation=0,WriteAllTimeSteps=0)
>
>
>
>
>
>



More information about the ParaView mailing list