[vtkusers] Display a STL file with vtk and Java _ vtkSTLReader

-Daniel- ich_daniel at habmalnefrage.de
Mon May 26 15:16:26 EDT 2014


Hi Mark,

try this...
/
private void importSTL(String file){
   vtkActor actor = new vtkActor();
   vtkSTLReader importer = new vtkSTLReader();
   importer.SetFileName(file);
					
   vtkPolyDataMapper mapper = new vtkPolyDataMapper();
   mapper.SetInputConnection(importer.GetOutputPort());
	
   actor.SetMapper(mapper);

  // if you have not a renderer outside of this method, ...
   vtkRenderer renderer = new vtkRenderer();
   vtkRenderWindow renderWindow = new vtkRenderWindow();
   renderWindow.AddRenderer(renderer);

   vtkRenderWindowInteractor renderWindowInteractor = new
vtkRenderWindowInteractor();
   renderWindowInteractor.SetRenderWindow(renderWindow);
     
   renderer.AddActor(actor);
   renderer.SetBackground(.3, .6, .3); // Background color green

   renderWindow.Render();
   renderWindowInteractor.Start();
}
/
I hope that helps.




--
View this message in context: http://vtk.1045678.n5.nabble.com/Display-a-STL-file-with-vtk-and-Java-vtkSTLReader-tp5727234p5727237.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list