[vtkusers] Using "Boolean Operations on Surfaces" on arbitrary mesh (stl) files

Cory Quammen cquammen at cs.unc.edu
Mon Aug 8 22:18:26 EDT 2011


The boolean operations filters only work on triangle meshes. If your
STL files do not contain triangle meshes, make sure to put a
vtkTriangleFilter between the STL reader and the boolean operations
filter.

Cory

On Mon, Aug 8, 2011 at 6:44 PM, louis10th <doyoungchang at gmail.com> wrote:
> Dear all:
> I am trying to import stl files  -> perform Boolean operations -> calculate
> volume of final mesh
>
> I've tried using the "Boolean Operations on Surfaces in VTK Without External
> Libraries"
> http://www.insight-journal.org/browse/publication/797
>
> but have failed. Does this work on arbitrary stl files or do I have to find
> a different method?
>
> Also, after the Boolean, what will be the best way to evaluate the volume?
>
> Thanks!
>
> Doyoung
>
>
>
> --------------------------------------------
>
>
> vtkSTLReader *volumeReader = vtkSTLReader::New();
>                volumeReader->SetFileName("test.stl");
> vtkSTLReader *volumeReader2 = vtkSTLReader::New();
>                volumeReader2->SetFileName("test2.stl");
>
> vtkSmartPointer<vtkBooleanOperationPolyDataFilter> boolFilter =
>    vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New();
>  boolFilter->SetOperation( 0 );
>  boolFilter->SetInputConnection( 0, volumeReader->GetOutputPort() );
>  boolFilter->SetInputConnection( 1, volumeReader2->GetOutputPort() );
>
>  vtkSmartPointer<vtkPolyDataMapper> mapper =
>    vtkSmartPointer<vtkPolyDataMapper>::New();
>  mapper->SetInputConnection( boolFilter->GetOutputPort( 0 ) );
>  mapper->ScalarVisibilityOff();
>
>  vtkActor *actor = vtkActor::New();
>  actor->SetMapper( mapper );
>        renderer->AddActor( actor );
>        actor->Delete();
>
>        volumeReader->Delete();
>        volumeReader2->Delete();
>  renWin->Render();
>  renWinInteractor->Start();
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Using-Boolean-Operations-on-Surfaces-on-arbitrary-mesh-stl-files-tp4680076p4680076.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://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Cory Quammen
Research Associate
Department of Computer Science
The University of North Carolina at Chapel Hill



More information about the vtkusers mailing list