[vtkusers] How to use vtkBooleanOperationPolyDataFilter correctly

santosh scbiradar at gmail.com
Tue Sep 23 05:27:06 EDT 2014


Hi All,

I am trying to use  vtkBooleanOperationPolyDataFilter to find
union/difference/intersection of two STL surfaces. Even if I use two
disconnected surfaces I am getting a hole in the STL which I provide as
first input to the filter if I do a Union operation.  I am doing the
following operations to read the input files

 #read file_one
    stl1 = vtk.vtkSTLReader()
    stl1.SetFileName(file_name)
    stl1.Update()
    
    
    poly1 = stl1.GetOutput()
    
    # Smooth the polyData
    smoothf0 = vtk.vtkSmoothPolyDataFilter()
    smoothf0.SetInput(poly1)
    smoothf0.Update() 
    
    # Remove Duplicate points/unused points/degenerate cells
    cleanf1 = vtk.vtkCleanPolyData()
    cleanf1.SetInput(smoothf0.GetOutput())
    cleanf1.ConvertStripsToPolysOn()
    cleanf1.ConvertPolysToLinesOn()
    cleanf1.ConvertLinesToPointsOn()
    cleanf1.Update() 
    
    # Conversion to Triangles
    trif0 = vtk.vtkTriangleFilter()
    trif0.SetInput(cleanf1.GetOutput())
    trif0.PassVertsOff()
    trif0.PassLinesOff()
    trif0.Update() 
    
    # Recompute Normals
    normalf0 = vtk.vtkPolyDataNormals()
    normalf0.SetInput(trif0.GetOutput())
    normalf0.ComputePointNormalsOn()
    normalf0.ComputeCellNormalsOff()
    normalf0.SplittingOff()
    normalf0.ConsistencyOn()
    normalf0.AutoOrientNormalsOff()
    normalf0.Update() 

Now , I use normalf0's output port as input connection to the filter. 
Is there any thing else I need to do to ensure I am providing the correct
input to the filter.
I am attaching images of the two STL files and the image of the output of
the union operation on the input files. 
input.png contains both the input STL files
union.png contains the result of the union operation on the two STL files
input.png <http://vtk.1045678.n5.nabble.com/file/n5728839/input.png>  
union.png <http://vtk.1045678.n5.nabble.com/file/n5728839/union.png>  

cheers,
Santosh



--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-use-vtkBooleanOperationPolyDataFilter-correctly-tp5728839.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list