[Paraview] small ParaView Script not working

Cory Quammen cory.quammen at kitware.com
Fri Dec 4 16:54:23 EST 2015


Marco,

Which part of your script isn't working? Are the files not being saved?

Thanks,
Cory

On Fri, Nov 27, 2015 at 6:55 AM, Marco Kokic <kokicm at student.ethz.ch> wrote:

> 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)
>>
>>
>>
>>
>>
>>
>>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151204/20eebc3e/attachment.html>


More information about the ParaView mailing list