[vtkusers] Performing a Logical And on two PolyData Sets?

Rob Remke robert_remke at starkey.com
Tue Jan 20 17:51:27 EST 2009


VTK Users,

Is there a filter like vtkImageLogic that will operate on two PolyData sets.  I want to perform a logical AND on two PolyData sets to extract the common volume.  I can't find any filter in VTK that will allow me to do that directly.  Is there something and maybe I missed it?

If there is not a simple approach as above, I thought that an alternative might be to read the two data sets in.  Input one into a vtkImplicitDataSet object and then input that and the other data set into a vtkClipPolyData object:

    Private Sub CodeSnippet()

        OpenFileDialog1.Multiselect = True
        OpenFileDialog1.Filter = "STL Files (*.stl)|*.stl"
        OpenFileDialog1.FilterIndex = 1
        OpenFileDialog1.ShowDialog()
        Me.Refresh()

        Dim Object1 As New vtkSTLReader
        Object1.SetFileName(OpenFileDialog1.FileNames(0))

        Dim Object2 As New vtkSTLReader
        Object2.SetFileName(OpenFileDialog1.FileNames(1))

        Dim ImplicitData As New vtkImplicitDataSet
        ImplicitData.SetDataSet(Object1.GetOutput)

        Dim Clipper As New vtkClipPolyData
        Clipper.SetInput(Object2.GetOutput)
        Clipper.SetClipFunction(ImplicitData)
        Clipper.GenerateClipScalarsOn()
        Clipper.GenerateClippedOutputOn()
        Clipper.SetValue(0)

    End Sub

When I Input Clipper.GetOut into a Mapper and try to render, I get the following error:
ERROR: In ..\..\VTK-5-2-0\VTK\Filtering\vtkImplicitDataSet.cxx, line 77
vtkImplicitDataSet (04280888): Can't evaluate dataset!

I am using Activis.NET in Visual Basic .NET.

Does anyone know what this error is?  If I could get the above code to work then maybe I could repeat the process.  First clip Object2 with Object1.  Then clip Object1 with Object2.  Then combine the results to get a data set representing the common volume of the two objects.

Thanks in advance for any help.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090120/2f49782b/attachment.htm>


More information about the vtkusers mailing list