[vtkusers] How to use vtkBooleanOperationPolyDataFilter correctly

Cory Quammen cory.quammen at kitware.com
Tue Sep 23 08:31:20 EDT 2014


Hi Santosh,

The vtkBooleanOperationPolyDataFilter won't work for these inputs. It
expects the input surfaces to enclose a volume, and the output surface
it will attempt to produce is the boundary of the union of the
enclosed volumes. The input surfaces don't necessarily need to be
water tight, but if they don't enclose a volume, results are going to
be unexpected.

If you want the union of these particular inputs, I would suggest
using the vtkAppendPolyData filter.

Hope that helps,
Cory

On Tue, Sep 23, 2014 at 5:27 AM, santosh <scbiradar at gmail.com> wrote:
> 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.
> _______________________________________________
> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list