CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] Extract Slice Plane Dimensions in PvPython (https://www.cfd-online.com/Forums/paraview/160910-extract-slice-plane-dimensions-pvpython.html)

AeroJ October 15, 2015 09:44

Extract Slice Plane Dimensions in PvPython
 
Hi everyone,

Does anyone know how to (or if it possible to) obtain the coordinates of the vertices of a slice plane in PvPython?

I've been able to access the grid point coordinates contained within the slice with:

servermanager.Fetch(SliceName).GetPoint(PointIndex )

but I also need to find out where the vertices of the slice plane are so that I can construct a tangent vector to the plane.

Any help would be greatly appreciated!

Thanks!

Flowkersma October 16, 2015 05:09

Hi,

Here are a few snippets that may interest you:

Bounding box:
Code:

bbox = slice.GetDataInformation().GetBounds()
print 'xbounds:', bbox[0:2], 'ybounds:', bbox[2:4], 'zbounds', bbox[4:]

Coordinates:
Code:

from paraview import numpy_support as ns
data = servermanager.Fetch(slice)
coordinates = ns.vtk_to_numpy(data.GetPoints().GetData())
print 'xcoords:', coordinates[:,0], 'ycoords:', coordinates[:,1], 'zcoords', coordinates[:,2]

Surface normals:
Code:

from paraview import numpy_support as ns
pvNormals = GenerateSurfaceNormals(slice)
data = servermanager.Fetch(pvNormals)
normals = ns.vtk_to_numpy(data.GetPointData().GetArray('Normals'))
print 'Normals', normals

Regards,
Mikko

AeroJ October 31, 2015 18:52

Thanks for that Mikko, they were very helpful snippets :) Is there any documentation anywhere that can tell me what attributes and methods the Paraview vtk objects have? Basically, is there any documentation with more snippets that might be useful??

Jack001 November 3, 2015 12:55

Have you checked The ParaView Guide-v4.3? I found it really helpful so far in my quest to learn paraview.


All times are GMT -4. The time now is 08:01.