[Paraview] How to export data from an ExtractBlock in a table?

NURI Adrien Adrien.NURI at aeroconseil.com
Fri Nov 27 04:57:59 EST 2009


Hi, 
Sorry for the tardiness answer.
Finally, I achieved the code. The main problem was the input type.
I arrived to convert data from the filter ExtractSurface into data usable by the DataSetCSVWriter.


Thanks for your advice
Adrien


PS: This is the code

#-----Paraview  V3.6.1----------------
#obligatoire pour lire le fichier code:
#(se connecter au severmanager)
#-------------------------------------
from paraview.simple import *
servermanager.Connect()

#origine du fichier (exemple d'un fichier source de type ensightcase)
chemin='ensight_3D\/ensightb.case'
donnees=servermanager.sources.EnSightReader(CaseFileName=chemin)

###############################################################################

#Fonction ExtractBlock:
#----------------------

name_extract=servermanager.filters.ExtractBlock(Input=donnees)
#choix des parties a extraire
#A,B...: numeros des parties que l'on souhaite utiliser
name_extract.BlockIndices=(3)

#L'option pruneoutput permet de supprimer les noeuds qui ne contiennent pas de valeurs.
#X est un bouleen et sa valeur par defaut est: 1
name_extract.PruneOutput=(1)

#########################################################################

#Fonction ExtractSurface:
#------------------------

#This filter extracts the polygons forming the outer surface of the input dataset.This filter operates on any type of data and produces polygonal data as output.
name_surf= ExtractSurface(Input=name_extract)

#PieceInvariant
 #If the value of this property is set to 1, internal surfaces along process boundaries will be removed. 
 #NOTE: Enabling this option might cause multiple executions of the data source because more information is needed to remove internal surfaces.
#X est un booleen et sa valeur par defaut est: 1
name_surf.PieceInvariant=(1)
 
#########################################################################

#fonction: Writers
#------------------

#Creation d un fichier au format "VTP" contenant les valeurs sur la surface selectionnees ("name_surf")
fichier2=XMLMultiBlockDataWriter(Input=name_surf, FileName="data-writer")
fichier2.UpdatePipeline()


#Conversion du fichier au format "VTP" en fichier au format "csv"

#XMLPolyDataReader
XMLPolyDataReader(FileName='data-writer_data\/data-writer_data_0.vtp')

#DataSetCSVWriter
fichier=DataSetCSVWriter(FileName="data-writer_reader")

#FieldAssociation
 #Select the attribute data to pass. 
#X=0: attribute = "Points"
#X=1: attribute = "Cells"
#X=2: attribute = "Field Data"
#Valeur par defaut X=0
fichier.FieldAssociation=(0)

#WriteAllTimeSteps
 #When WriteAllTimeSteps is turned ON (X=1), the writer is executed once for each timestep available from the reader.
#X est un booleen et sa valeur par defaut est X=0
fichier.WriteAllTimeSteps=(0)

fichier.UpdatePipeline()

#########################################################################








-----Message d'origine-----
De : Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com] 
Envoyé : vendredi 20 novembre 2009 22:33
À : NURI Adrien
Cc : paraview at paraview.org
Objet : Re: [Paraview] How to export data from an ExtractBlock in a table?

Using DataSetCSVWriter should do the trick.

Utkarsh

On Mon, Nov 16, 2009 at 10:14 AM, NURI Adrien
<Adrien.NURI at aeroconseil.com> wrote:
> Hi,
>
> In fact, I'm working in script Pyhton. I'm using Paraview V3.4 and V3.6.1.
> My script uses a source's file "ensightcase", then I apply a filter "ExtractBlock" to keep only the data along a surface. Then, I would like to create a file "CSV" with all the values of my variables on the extracted surface.
>
> Later, I'll apply a post processing in order to calculate the Max, Min, and Moy of all the variables (temperature, pressure, speed...) along the surface.
>
> So, my problem is how I can create a file CSV in script Python.
> Thanks.
>
> Adrien
>
>
> -----Message d'origine-----
> De : Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
> Envoyé : vendredi 13 novembre 2009 18:14
> À : NURI Adrien
> Cc : paraview at paraview.org
> Objet : Re: [Paraview] How to export data from an ExtractBlock in a table?
>
> What do you mean by export to a table? Are you simply interested in
> looking at the raw point data or cell data values? Or do you want to
> create a vtkTable?
>
>
> Utkarsh
>
> On Fri, Nov 13, 2009 at 11:24 AM, NURI Adrien
> <Adrien.NURI at aeroconseil.com> wrote:
>> Hello,
>>
>>
>>
>> I'm using paraview in batch, and I would like to export data from an
>> ExtractBlock filter in a table.
>>
>> I would like to use values (temperature, pressure...) of the extracted part in
>> a python script for post-processing.
>>
>> Is it possible to do that?
>>
>> Thanks a lot.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ________________________________
>> Le contenu de ce message est prévu uniquement pour le destinataire nommé. Il
>> contient des informations qui peuvent être confidentielles. A moins d'être
>> le destinataire nommé ou autorisé par le destinataire, vous ne pouvez pas
>> copier, employer ou révéler à une autre personne le contenu de ce message.
>> Si vous le recevez par erreur, s'il vous plait, informez nous immédiatement
>> et détruisez le.
>>
>> The contents of this e-mail are intended for the named addressee only. It
>> contains information that may be confidential. Unless you are the named
>> addressee or an authorized designee, you may not copy or use it, or disclose
>> it to anyone else. If you received it in error please notify us immediately
>> and then destroy it.
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> Le contenu de ce message est prévu uniquement pour le destinataire nommé. Il contient des informations qui peuvent être confidentielles. A moins d'être le destinataire nommé ou autorisé par le destinataire, vous ne pouvez pas copier, employer ou révéler à une autre personne le contenu de ce message. Si vous le recevez par erreur, s'il vous plait, informez nous immédiatement et détruisez le.
>
> The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
>


Le contenu de ce message est prévu uniquement pour le destinataire nommé. Il contient des informations qui peuvent être confidentielles. A moins d'être le destinataire nommé ou autorisé par le destinataire, vous ne pouvez pas copier, employer ou révéler à une autre personne le contenu de ce message. Si vous le recevez par erreur, s'il vous plait, informez nous immédiatement et détruisez le.

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it. 


More information about the ParaView mailing list