[Paraview] Do the GetCellEdgeNeighbors / GetCellNeighbors methods in vtkPolyData not work for polygons?

Evan Kao tossin at gmail.com
Fri Dec 11 14:16:30 EST 2015


Hi all,

I've been playing around with the GetCellEdgeNeighbors and GetCellNeighbors
methods in the vtkPolyData class and testing them on a cylinder source in
Paraview 4.3.1, which generates a surface made of vtkQuads for the sides
and vtkPolygons for caps.  I've applied the Clean filter to the cylinder
since the caps generate duplicate points.

[image: Inline image 1]

Within a programmable filter, I've tested the following script:

import numpy as np

in1 = self.GetPolyDataInput()
surface = self.GetOutput()
surface.DeepCopy(in1)
surface.BuildCells()
surface.BuildLinks()

cellId = 0 # a vtkQuad
cellPtIds = vtk.vtkIdList()
surface.GetCellPoints(cellId, cellPtIds)
cellPtIds = [cellPtIds.GetId(i) for i in xrange(cellPtIds.GetNumberOfIds())]
cellPtIds = np.array(cellPtIds).astype(np.int64)
cellEdges = [[id0, id1] for id0, id1 in zip(cellPtIds[:-1], cellPtIds[1:])]
cellEdges.append( [cellPtIds[-1], cellPtIds[0]] )

edgeId = 0 # or 1,2,3
edge = cellEdges[edgeId]

edgeIdList = vtk.vtkIdList()
for i in xrange(2):
    edgeIdList.InsertNextId(edge[i])
singleCellEdgeNeighborIds = vtk.vtkIdList()
#surface.GetCellEdgeNeighbors(cellId, edge[0], edge[1],
singleCellEdgeNeighborIds)
surface.GetCellNeighbors(cellId, edgeIdList, singleCellEdgeNeighborIds)

If the edge neighbor cell is a vtkQuad, the script works.  But if the edge
neighbor cell corresponds to one of the caps, Paraview will crash.  Is
there a way to get this to work?

Thanks,
Evan Kao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151211/cf8e101b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 34858 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/paraview/attachments/20151211/cf8e101b/attachment.png>


More information about the ParaView mailing list