[Paraview] Export spreadsheet values through python scripting
Masquelet, Matthieu (GE Global Research)
masquelet at ge.com
Tue Mar 19 14:06:04 EDT 2013
Hum, I tried your suggestion but I can't get it to work:
- if I try "threshold" as argument for CreateWriter I get messages of the like:
Traceback (most recent call last):
File "<string>", line 123, in <module>
File "/software/paraview-3.98.1/lib/paraview-3.98/site-packages/paraview/simple.py", line 208, in CreateWriter
writer_proxy = writer_factory.CreateWriter(filename, proxy.SMProxy, proxy.Port)
AttributeError: 'str' object has no attribute 'SMProxy'
- if I don't bother and only put a filename, I don't think the CreateWriter instance is created correctly:
Traceback (most recent call last):
File "<string>", line 125, in <module>
AttributeError: 'NoneType' object has no attribute 'FieldAssociation'
Does that mean my vtk install is not correct/up to date? (I'm not sure what it is as this is managed by my sys admin...)
Thanks in advance,
Matthieu
-----Original Message-----
From: Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
Sent: Monday, March 18, 2013 10:32 PM
To: Masquelet, Matthieu (GE Global Research)
Cc: paraview at paraview.org
Subject: Re: [Paraview] Export spreadsheet values through python scripting
Spreadsheet View is not available in python scripts. However, you can save the csv dataset as follows:
> from paraview.simple import *
> writer = CreateWriter("/tmp/foo.csv", threshold) # 'threshold' is
> optional, if not specified
# active source is use
> writer.FieldAssociation = "Points" # or "Cells"
> writer.UpdatePipeline()
Utkarsh
On Mon, Mar 18, 2013 at 7:08 PM, Masquelet, Matthieu (GE Global
Research) <masquelet at ge.com> wrote:
> Dear all,
>
>
>
> Here is a rough outline of my python script:
>
> - Load data
>
> - Cut a slice
>
> - Compute new variable on the slice
>
> - Threshold the slice using new variable
>
> - Perform integration of other variables on the thresholded slice
>
> - Export results of the integration from the spreadsheet to a text
> file
>
>
>
> Up to the last step, all is swell. I originally recorded a trace and
> built a more general script out of it. However, no python was
> generated for the last step. Actually the spreadsheet view does not
> even show up when I run the python script. Is there a way for me to
> script this part? Manually what I do is I select the spreadsheet panel
> and go to File>Save Data... and specify format and filename.
>
> I have many integrations to do over many parts of the slice so it will
> be a problem if I cannot automate this last part.
>
>
>
> Thanks in advance for your help.
>
>
>
> I'm running 3.98.1 64-bit on RHEL 5, the data is unstructured
> following Tecplot format.
>
>
>
> Matthieu Masquelet, PhD
>
> Mechanical Engineer
>
> Computational Combustion Laboratory
>
> Combustion Systems Organization
>
> Aerothermal and Mechanical Systems
>
> GE Global Research
> One Research Circle, K1-2C36
> Niskayuna, NY 12309 United States
>
> GE imagination at work
>
>
>
>
> _______________________________________________
> 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
>
More information about the ParaView
mailing list