[Paraview] Writing IntegrateAttributes to CSV using Python

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon Apr 6 16:10:42 EDT 2009


Bart,

Here's how you'd do it with the CVS version of ParaView (you'll need
to make sure your ParaView is up-to-date since I just committed some
fixes exposing a filter used by this script).

from paraview import servermanager as sm
sm.Connect()
sphere = sm.sources.SphereSource()
ia = sm.filters.IntegrateAttributes(Input=sphere)

# AttributeDataToTableFilter converts any dataset to a vtkTable which can be
# written as a CSV file. One needs to choose which attribute to save as well.
# First save points.
convertor = sm.filters.AttributeDataToTableFilter(Input=ia,
  FieldAssociation="Points",
  AddMetaData=1)
csvWriter = sm.writers.CSVWriter(Input=convertor)
csvWriter.FileName = "/tmp/output.points.csv"

# this writes the output.
csvWriter.UpdatePipeline()

# Now save cells.
convertor.FieldAssociation="Cells"
csvWriter = sm.writers.CSVWriter(Input=convertor)
csvWriter.FileName = "/tmp/output.cells.csv"

# this writes the output.
csvWriter.UpdatePipeline()


Utkarsh

On Mon, Apr 6, 2009 at 3:57 PM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> What version of ParaView are you using?
>
> Utkarsh
>
> On Mon, Apr 6, 2009 at 11:28 AM,  <bart.boonacker at actiflow.com> wrote:
>> Dear All,
>>
>> I am looking for an example script/pointers on how to write
>> IntegrateAttributes
>> (Integrate01 =
>> servermanager.filters.IntegrateAttributes(registrationGroup='sources',registrationName='Integrator',Input=Calculator01))
>> to a CSV file, when using Python.
>>
>> I cannot find the right functions to do so.
>>
>> Thanks in advance,
>>
>> Bart
>> _______________________________________________
>> 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