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
_______________________________________________
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
Search the list archives at: http://markmail.org/search/?q=ParaView
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview