[vtkusers] Hole filling

Alexandre GOUAILLARD Alexandre.Gouaillard at Sun.COM
Tue Apr 11 21:19:01 EDT 2006


hi amitesh,

I did not test your code here, as I don't have the python emvironement set.
 From what I see you're trying to pass an UG to filters that expect 
polydata as input. I don' think it can work this way. That's just a wild 
guess. Did you try a polydata only version first to validate the port to 
python, and then try to modify it for UG?

could you give more information on where your code is hanging, error 
message, stack ...

alex (gouaillard with a G at the end).


Amitesh Agarwal wrote:
> Hi All,
> 
> 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 
> *Alexandre[dot]Gouaillar[at]sun[dot]com *in this same forum in c++. I 
> just rewrote it in python and it is crashing  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.
> 
> Thanks for your valuable time
> 
> With Best Regards
> Amitesh
> --------------------------------------------------------------------------------------- 
> 
> 
> #!/usr/bin/vtkpython
> import vtk
> reader = vtk.vtkUnstructuredGridReader()
> reader.SetFileName("/home/amitesh/testcase.vtk")
> 
> 
> meshin = vtk.vtkDataSetSurfaceFilter()
> meshin.SetInput(reader.GetOutput())
> 
> #Detect holes
> boundaryEdges = vtk.vtkFeatureEdges()
> boundaryEdges.SetInput(meshin.GetOutput())
> boundaryEdges.SetBoundaryEdges(1)
> boundaryEdges.SetFeatureEdges(0)
> boundaryEdges.SetNonManifoldEdges(0)
> boundaryEdges.SetManifoldEdges (0)
> boundaryEdges.Update()
> 
> #Number of Boundary Edges
> #nombreoutput = boundaryEdges.GetOutput()
> nombre = (boundaryEdges.GetOutput().GetNumberOfLines())
> 
> #number of Edge nodes
> pointsNumber = nombre
> 
> #Cleanup the mesh
> poly = vtk.vtkCleanPolyData()
> poly.SetInput(meshin.GetOutput())
> poly.Update()
> 
> region = vtk.vtkPolyDataConnectivityFilter()
> meshAppend = vtk.vtkAppendPolyData()
> bouchon = vtk.vtkStripper ()
> bouchonPoly = vtk.vtkPolyData()
> bouchontri = vtk.vtkTriangleFilter()
> 
> meshAppend.AddInput(poly.GetOutput())
> meshAppend.AddInput(bouchontri.GetOutput())
> 
> region.SetInputConnection(boundaryEdges.GetOutputPort ())
> region.SetExtractionMode(6)
> 
> bouchon.SetInput(region.GetOutput())
> bouchontri.SetInput(bouchonPoly)
> 
> poly.SetInput(meshAppend.GetOutput())
> poly.SetTolerance(0.0)
> poly.SetConvertLinesToPoints(0)
> poly.SetConvertPolysToLines(0)
> poly.SetConvertStripsToPolys(0)
> 
> boundaryEdges.SetInput(poly.GetOutput())
> while nombre != 0:
>         region.Update()
>         bouchonPoly.Initialize()
>         bouchonPoly.SetPoints (bouchon.GetOutput().GetPoints())
>         bouchonPoly.SetLines(bouchon.GetOutput().GetLines())
>         bouchonPoly.Update()
> 
>         #triangulate the polygonal patch
>         bouchontri.Update()
> 
>         #patch (add the patch to the mesh)
>         meshAppend.Update()
> 
>         #remove duplicated edges and points
>         poly.Update()
> 
>         #update the number of border edges
>         boundaryEdges.Update()
> 
>         nombre = boundaryEdges.GetOutput ().GetNumberOfLines()
> 
> meshout = vtk.vtkPolyData()
> meshout.DeepCopy(poly.GetOutput())
> meshout.Update()
> 
> Writer = vtk.vtkPolyDataWriter()
> Writer.SetFileName("/home/amitesh/testcasepatched.vtk")
> Writer.SetInput(meshout)
> Writer.Write()
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list