[Paraview] How to extract data array tuples using pvpython

Andreas Maier andi.maier at mytum.de
Wed Apr 7 11:12:44 EDT 2010


Hi,

I want to read cell data tuples in pvpython, but somehow I am stuck. My data 
is read from an ensight case file and I can process it until that point when 
I need to access the single tuples of my cell data arrays. Please find an 
extract of my pvpython-code below. Does anyone know how to solve that 
problem? Thanks in advance for your efforts.

Best regards,

Andreas

>from paraview import servermanager, vtk
>
>    # Set up connection to the Paraview server
>if not servermanager.ActiveConnection:
>	connection = servermanager.Connect()
>if not connection:
>	raise exceptions.RuntimeError, "Connection to server failed"
>
>    # read ensight source object
>reader = servermanager.sources.ensight()
>reader.ByteOrder = 1 	
>resultfile = "...._structure_new2.case"
>reader.CaseFileName = resultfile
>reader.UpdatePipelineInformation()
>
>    # Point to Cell Data
>ptc = servermanager.filters.PointDataToCellData(Input=reader)
>ptc.UpdatePipeline()
>    
>pdi = ptc.GetDataInformation().DataInformation
>numCells = pdi.GetNumberOfCells()
>celldata = pdi.GetCellDataInformation()
>
>    # here I get my vtkPVArrayInformation
>vM_array = celldata.GetArrayInformation("vMises_stress")
>for i in range(numCells):
>	vMises_str = vM_array.GetTuple1(i) ## <- this does not work


More information about the ParaView mailing list