[vtkusers] Soild *.stl format needed.
Lorensen, William E (Research)
lorensen at crd.ge.com
Mon Feb 24 08:47:17 EST 2003
You should be able to use the stl file to create rapid prototypes. We have done it many times.
Bill
-----Original Message-----
From: #YAN RI AN# [mailto:yanrian at pmail.ntu.edu.sg]
Sent: Monday, February 24, 2003 2:06 AM
To: vtkusers at public.kitware.com
Subject: [vtkusers] Soild *.stl format needed.
Dear All vtk users:
I need Solid *.stl format model for the rapid prototyping technology.
the MarchingCubes Algorithm only got isosurface *.stl format only.
I do not know how to solve the proplem.
Could any experts help me?
Here is my program:
//main program:
vtkVolume16Reader *v16=vtkVolume16Reader::New();
v16->SetDataDimensions(64,64);
v16->GetOutput()->SetOrigin(0,0,0);
v16->SetDataByteOrderToLittleEndian();
v16->SetFilePrefix("c:/Vtkdata/Data/headsq/quarter");
v16->SetImageRange(1,93);
v16->SetDataSpacing(3.2,3.2,1.5);
v16->Update();//put the image into memory
vtkMarchingCubes *iso=vtkMarchingCubes::New();
iso->SetInput(v16->GetOutput());
iso->SetValue(0,1150);
iso->ComputeGradientsOn();
iso->ComputeScalarsOff();
vtkPolyDataMapper *isoMapper=vtkPolyDataMapper::New();
isoMapper->SetInput(iso->GetOutput());
isoMapper->ScalarVisibilityOn();
isoMapper->ImmediateModeRenderingOn();
vtkActor *isoActor=vtkActor::New();
isoActor->SetMapper(isoMapper);
isoActor->GetProperty()->SetColor(1,1,1);
// Add the actors to the renderer, set the background and size
vtkRenderer *ren1 = vtkRenderer::New();
ren1->AddActor(isoActor);
ren1->SetBackground(0,0,1);
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren1);
renWin->SetSize(600,600);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
//
//STL OutPut
vtkTriangleFilter *triangles=vtkTriangleFilter::New();
triangles->SetInput(iso->GetOutput());
vtkDecimatePro *decimate=vtkDecimatePro::New();
decimate->SetInput(triangles->GetOutput());
decimate-> SetTargetReduction(0.9);
decimate-> PreserveTopologyOn();
vtkSTLWriter *stl=vtkSTLWriter::New();
stl->SetInput(decimate->GetOutput());
stl->SetFileName("head.stl");
stl->Write();
//
renWin->Render();
iren->Start();
v16->Delete();
iso->Delete();
isoMapper->Delete();
isoActor->Delete();
ren1->Delete();
renWin->Delete();
iren->Delete();
triangles->Delete();
decimate->Delete();
stl->Delete();
return 0;
}
***************************************
* Best Regards
* Yan Rian (Research Student)
* Email : yanrian at pmail.ntu.edu.sg
* Lab : AMRC Research Centre
* Nanyang Technological University
* Singapore
***************************************
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list