[vtkusers] Fwd: How to save STL file

Darshan Pai darshanpai at gmail.com
Thu Mar 8 19:40:13 EST 2012


---------- Forwarded message ----------
From: Darshan Pai <darshanpai at gmail.com>
Date: Thu, Mar 8, 2012 at 7:39 PM
Subject: Re: [vtkusers] How to save STL file
To: Chao Wang <buaawangchao at gmail.com>


Do you have to use VTK ? You can use any graphic editor to do this :)


But any way , you need to ensure that there are no polygons and only
triangular faces. You can use vtkTriangleFilter to convert polygons to
triangles

HTH

Darshan

On Thu, Mar 8, 2012 at 6:26 PM, Chao Wang <buaawangchao at gmail.com> wrote:

> Hey gus,
>
> I am new to VTK, and trying to conver a OBJ file to a STL file. I tried
> the following code section, but it didn't work. It did created a STL file,
> but with nothing inside, only 1KB. Any help and direction would be
> appreciated.
>
> Thanks.
>
>    vtkSmartPointer<vtkOBJReader> readerOBJ =
> vtkSmartPointer<vtkOBJReader>::New();
>    readerOBJ->SetFileName(filename.c_str());
>    readerOBJ->Update();
>
>   vtkSmartPointer<vtkSTLWriter> stlWriter =
> vtkSmartPointer<vtkSTLWriter>::New();
>   stlWriter->SetFileName("Bobcat.stl");
>   stlWriter->SetInputConnection(readerOBJ->GetOutputPort());
>   stlWriter->Write();
>
> --
> Chao Wang
> Graduate Research Assistant
> The Durham School of Architectural Engineering and Construction
> University of Nebraska - Lincoln
> The Peter Kiewit Institute
> 1110 S. 67th Street 118A
> Omaha, NE 68182-0571
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120308/f604a062/attachment.htm>


More information about the vtkusers mailing list