vtkSTLWriter.h 1.72 KB
Newer Older
Will Schroeder's avatar
Will Schroeder committed
1 2
/*=========================================================================

Ken Martin's avatar
Ken Martin committed
3
  Program:   Visualization Toolkit
Ken Martin's avatar
Ken Martin committed
4
  Module:    vtkSTLWriter.h
Will Schroeder's avatar
Will Schroeder committed
5

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
Ken Martin's avatar
Ken Martin committed
9

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
Will Schroeder's avatar
Will Schroeder committed
13 14

=========================================================================*/
Ken Martin's avatar
Ken Martin committed
15
// .NAME vtkSTLWriter - write stereo lithography files
Will Schroeder's avatar
Will Schroeder committed
16
// .SECTION Description
Ken Martin's avatar
Ken Martin committed
17
// vtkSTLWriter writes stereo lithography (.stl) files in either ASCII or
Bill Lorensen's avatar
Bill Lorensen committed
18
// binary form. Stereo lithography files only contain triangles. If polygons
Ken Martin's avatar
Ken Martin committed
19 20 21
// with more than 3 vertices are present, only the first 3 vertices are
// written.  Use vtkTriangleFilter to convert polygons to triangles.

Will Schroeder's avatar
Will Schroeder committed
22 23
// .SECTION Caveats
// Binary files written on one system may not be readable on other systems.
Ken Martin's avatar
Ken Martin committed
24
// vtkSTLWriter uses VAX or PC byte ordering and swaps bytes on other systems.
Will Schroeder's avatar
Will Schroeder committed
25

Ken Martin's avatar
Ken Martin committed
26 27
#ifndef __vtkSTLWriter_h
#define __vtkSTLWriter_h
Will Schroeder's avatar
Will Schroeder committed
28

Will Schroeder's avatar
Will Schroeder committed
29
#include "vtkPolyDataWriter.h"
Will Schroeder's avatar
Will Schroeder committed
30

31
class VTK_IO_EXPORT vtkSTLWriter : public vtkPolyDataWriter
Will Schroeder's avatar
Will Schroeder committed
32 33
{
public:
34
  static vtkSTLWriter *New();
Brad King's avatar
Brad King committed
35
  vtkTypeRevisionMacro(vtkSTLWriter,vtkPolyDataWriter);
36
  virtual void PrintSelf(ostream& os, vtkIndent indent);
Will Schroeder's avatar
Will Schroeder committed
37 38

protected:
39 40
  vtkSTLWriter();
  ~vtkSTLWriter() {};
41

Will Schroeder's avatar
Will Schroeder committed
42
  void WriteData();
Will Schroeder's avatar
Will Schroeder committed
43

Ken Martin's avatar
Ken Martin committed
44 45
  void WriteBinarySTL(vtkPoints *pts, vtkCellArray *polys);
  void WriteAsciiSTL(vtkPoints *pts, vtkCellArray *polys);
46 47 48
private:
  vtkSTLWriter(const vtkSTLWriter&);  // Not implemented.
  void operator=(const vtkSTLWriter&);  // Not implemented.
Will Schroeder's avatar
Will Schroeder committed
49 50 51 52
};

#endif