[Paraview] Maintain triangulation of slive from vtk to numpy

Gallagher, Timothy P tim.gallagher at gatech.edu
Tue Mar 7 09:17:32 EST 2017


Kyle,


Once you get a slice, you can extract the underlying vtkUnstructuredGrid and use that to extract the connectivity. For example:


uns_grid = servermanager.Fetch(slice)


npts = uns_grid.GetNumberOfCells()


for n in xrange(npts):

    ptids = vtk.vtkIdList()

    uns_grid.GetCellPoints(0, ptids)

    print [ptids.GetId(i) for i in xrange(ptids.GetNumberOfIds())]


And you can interchange the words Point and Cell to get the inverse information (all of the cells using a given point).


I tried playing around with something along the lines of:


uns_grid.BuildLinks()

links = uns_grid.GetCellLinks()

npts = uns_grid.GetNumberOfPoints()


for i in xrange(npts)

    print links.GetCells(i)


but GetCells returns a vtkIdType pointer, which in Python shows up as a string containing an address in memory. I couldn't figure out how to translate that back into something meaningful.


Tim


________________________________
From: ParaView <paraview-bounces at paraview.org> on behalf of Schau, Kyle A <kschau at gatech.edu>
Sent: Wednesday, March 1, 2017 12:35 PM
To: paraview at paraview.org
Subject: [Paraview] Maintain triangulation of slive from vtk to numpy


Hello All


Does anyone know if the capability exists to extract slice data through the python interface of paraview that contains the triangulation data of the slice? This would allow one to pull flattened VTK data in the form of numpy arrays, but still plot non-convex slice geometries easily with mayplotlib.tricont()


Thanks for your help.


Kyle A. Schau


Graduate Research Assistant


Computational Combustion Lab

Georgia Institute of Technology

Atlanta, GA


(269)-986-4579
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170307/906811dd/attachment.html>


More information about the ParaView mailing list