<span class="gmail_quote"></span>Hi All,<br><div style="direction: ltr;"><br>I was attempting hole filling using this code while customizing it for an unstructured grid as input. I am getting segmentation fault error. Please note that this code was sent by
<b><span class="nw" id="_user_Alexandre.Gouaillard@sun.com">Alexandre[dot]Gouaillar[at]sun[dot]com </span></b><span class="nw" id="_user_Alexandre.Gouaillard@sun.com">in this same forum in c++. I just rewrote it in python and it is crashing
</span>due to some update bug about which I have no idea. I would be really
thankful if you (or anyone else ) could point me towards the error in the code or a possible get around to this problem.<br><br>Thanks for your valuable time<br><br>With Best Regards<br>Amitesh<br>---------------------------------------------------------------------------------------
<br><br>#!/usr/bin/vtkpython<br>import vtk
<br>reader = vtk.vtkUnstructuredGridReader()<br>reader.SetFileName("/home/amitesh/testcase.vtk")<br><br><br>meshin = vtk.vtkDataSetSurfaceFilter()<br>meshin.SetInput(reader.GetOutput())<br><br>#Detect holes<br>
boundaryEdges = vtk.vtkFeatureEdges()<br>boundaryEdges.SetInput(meshin.GetOutput())<br>boundaryEdges.SetBoundaryEdges(1)<br>boundaryEdges.SetFeatureEdges(0)<br>boundaryEdges.SetNonManifoldEdges(0)<br>boundaryEdges.SetManifoldEdges
(0)<br>boundaryEdges.Update()<br><br>#Number of Boundary Edges<br>#nombreoutput = boundaryEdges.GetOutput()<br>nombre = (boundaryEdges.GetOutput().GetNumberOfLines())<br><br>#number of Edge nodes<br>pointsNumber = nombre<br>
<br>#Cleanup the mesh<br>poly = vtk.vtkCleanPolyData()<br>poly.SetInput(meshin.GetOutput())<br>poly.Update()<br><br>region = vtk.vtkPolyDataConnectivityFilter()<br>meshAppend = vtk.vtkAppendPolyData()<br>bouchon = vtk.vtkStripper
()<br>bouchonPoly = vtk.vtkPolyData()<br>bouchontri = vtk.vtkTriangleFilter()<br><br>meshAppend.AddInput(poly.GetOutput())<br>meshAppend.AddInput(bouchontri.GetOutput())<br><br>region.SetInputConnection(boundaryEdges.GetOutputPort
())<br>region.SetExtractionMode(6)<br><br>bouchon.SetInput(region.GetOutput())<br>bouchontri.SetInput(bouchonPoly)<br><br>poly.SetInput(meshAppend.GetOutput())<br>poly.SetTolerance(0.0)<br>poly.SetConvertLinesToPoints(0)<br>
poly.SetConvertPolysToLines(0)<br>poly.SetConvertStripsToPolys(0)<br><br>boundaryEdges.SetInput(poly.GetOutput())<br>while nombre != 0:<br> region.Update()<br> bouchonPoly.Initialize()<br> bouchonPoly.SetPoints
(bouchon.GetOutput().GetPoints())<br> bouchonPoly.SetLines(bouchon.GetOutput().GetLines())<br> bouchonPoly.Update()<br><br> #triangulate the polygonal patch<br> bouchontri.Update()<br><br> #patch (add the patch to the mesh)
<br> meshAppend.Update()<br><br> #remove duplicated edges and points<br> poly.Update()<br><br> #update the number of border edges<br> boundaryEdges.Update()<br><br> nombre = boundaryEdges.GetOutput
().GetNumberOfLines()<br><br>meshout = vtk.vtkPolyData()<br>meshout.DeepCopy(poly.GetOutput())<br>meshout.Update()<br><br>Writer = vtk.vtkPolyDataWriter()<br>Writer.SetFileName("/home/amitesh/testcasepatched.vtk")
<br>Writer.SetInput(meshout)<br>Writer.Write()<br></div><br clear="all">