[vtkusers] How can I save to STL format?

David Doria daviddoria+vtk at gmail.com
Fri Jun 4 13:30:30 EDT 2010


2010/6/4 noc <hawkingyy at hotmail.com>:
> Hi all,
>
> Now, I'm doing marching cubes. I wanna save the resault(the 3D image) to STL
> format,
> I tried this:
> --code--
> vtkSTLWriter * writeSTL = vtkSTLWriter ::New();
>   writeSTL->SetFileName("D:/data/feet.stl");
>   writeSTL->SetInput(stripper->GetOutput());   //data from vtkStripper
>   writeSTL->Write();
> --code--
>
> but it didn't work. The feet.stl is only 1KB.
> However, I can see the 3D surface in RenderWindow. I don't konw why.
> Could any one help me, please?
>
> Thanks so much!!!
>
> Regards,
>
> Danile

Try using vtkXMLPolyDataWriter to write a .vtp file and open it in
Paraview. If this result is also incorrect, then there is some problem
upstream in the pipeline. It doesn't look like you are doing anything
wrong with the vtkSTLWriter.

David



More information about the vtkusers mailing list