[vtkusers] vtkSTLWriter, WriteBinarySTL

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Apr 14 11:11:16 EDT 2005


Jeremy Winston wrote:
> TKB 3. Prakt. Corina Farcas wrote:
> 
>> Hello vtkusers!
>>
>> I have a litte problem: I am trying to write an STL file as a binary 
>> File and I dont know what Parameter I need for the Function 
>> WriteBinarySTL:
>> ...
>> vtkSTLWriter *stl = vtkSTLWriter::New();
>> stl->SetInput((vtkPolyData*) contour->GetOUtput());
>> stl->SetFileName("test.stl");
>> stl->WriteBinarySTL(pts, polys);
>>                      ??    ??
> 
> 
> You don't need to call WriteBinarySTL() directly;
> all you have to do is set the file type to binary,
> and then invoke the Write() method:
> 
>   stl->SetFileTypeToBinary();
>   stl->Write()
> 
> Write() extracts the points & polys from the polydata
                                 ^^^^^

Actually only the triangles. You need to pass the polydata throught a 
vtkTriangleFilter first if you want to save other type of polys (they 
are changed to triangles).

HTH,
Mathieu



More information about the vtkusers mailing list