VTK
vtkSTLWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSTLWriter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef vtkSTLWriter_h
34 #define vtkSTLWriter_h
35 
36 #include "vtkIOGeometryModule.h" // For export macro
37 #include "vtkWriter.h"
38 
39 class vtkCellArray;
40 class vtkPoints;
41 class vtkPolyData;
43 
44 class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkWriter
45 {
46 public:
47  static vtkSTLWriter *New();
48  vtkTypeMacro(vtkSTLWriter,vtkWriter);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
58 
60 
63  vtkSetStringMacro(FileName);
64  vtkGetStringMacro(FileName);
66 
68 
72  vtkSetStringMacro(Header);
73  vtkGetStringMacro(Header);
75 
77 
83  virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
84  vtkGetObjectMacro(BinaryHeader, vtkUnsignedCharArray);
86 
88 
91  vtkSetClampMacro(FileType,int,VTK_ASCII,VTK_BINARY);
92  vtkGetMacro(FileType,int);
93  void SetFileTypeToASCII() {this->SetFileType(VTK_ASCII);};
94  void SetFileTypeToBinary() {this->SetFileType(VTK_BINARY);};
96 
97 protected:
98  vtkSTLWriter();
99  ~vtkSTLWriter() override;
100 
101  void WriteData() override;
102 
103  void WriteBinarySTL(
104  vtkPoints *pts, vtkCellArray *polys, vtkCellArray *strips);
105  void WriteAsciiSTL(
106  vtkPoints *pts, vtkCellArray *polys, vtkCellArray *strips);
107 
108  char *FileName;
109  char *Header;
111  int FileType;
112 
113  int FillInputPortInformation(int port, vtkInformation *info) override;
114 
115 private:
116  vtkSTLWriter(const vtkSTLWriter&) = delete;
117  void operator=(const vtkSTLWriter&) = delete;
118 };
119 
120 #endif
121 
Store vtkAlgorithm input/output information.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
#define VTK_ASCII
Definition: vtkWriter.h:39
char * FileName
Definition: vtkSTLWriter.h:108
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkSTLWriter.h:93
abstract class to write data to file(s)
Definition: vtkWriter.h:42
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkSTLWriter.h:94
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkUnsignedCharArray * BinaryHeader
Definition: vtkSTLWriter.h:110
vtkDataObject * GetInput()
#define VTK_BINARY
Definition: vtkWriter.h:40
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
dynamic, self-adjusting array of unsigned char
object to represent cell connectivity
Definition: vtkCellArray.h:50
write stereo lithography files
Definition: vtkSTLWriter.h:44
static vtkAlgorithm * New()
virtual void WriteData()=0
represent and manipulate 3D points
Definition: vtkPoints.h:39