[Paraview] Writing IntegrateAttributes to CSV using Python

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Apr 8 10:19:34 EDT 2009


Bart,

You can create a writer of the type you want eg.
XMLUnstructuredGridWriter and set the input etc. exactly as I did for
the example I sent you.  Writing CSV through python is not possible
through 3.4, if I remember correctly.

Utkarsh

On Wed, Apr 8, 2009 at 3:27 AM,  <bart.boonacker at actiflow.com> wrote:
> Hey Utkarsh,
>
> I am using paraview 3.4.0, the linux 64bit version. I have not worked with
> the CVS version yet, but I am trying to get it to work.
> No luck so far, but is there perhaps another way, without using the CVS
> version, to write my integrated variables ?
> Maybe to another file, not csv for instance ?
>
> Thanks in advance,
> Bart
>
> On Mon, 6 Apr 2009 16:10:42 -0400, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
>> 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