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

louis10th doyoungchang at gmail.com
Mon Aug 8 18:44:31 EDT 2011


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.



More information about the vtkusers mailing list