VTK  9.1.0
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 =========================================================================*/
49 #ifndef vtkSTLWriter_h
50 #define vtkSTLWriter_h
51 
52 #include "vtkIOGeometryModule.h" // For export macro
53 #include "vtkWriter.h"
54 
55 class vtkCellArray;
56 class vtkPoints;
57 class vtkPolyData;
59 
60 class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkWriter
61 {
62 public:
63  static vtkSTLWriter* New();
64  vtkTypeMacro(vtkSTLWriter, vtkWriter);
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
68 
74 
76 
82 
84 
88  vtkSetStringMacro(Header);
89  vtkGetStringMacro(Header);
91 
93 
99  virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
100  vtkGetObjectMacro(BinaryHeader, vtkUnsignedCharArray);
102 
104 
107  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
108  vtkGetMacro(FileType, int);
109  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
110  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
112 
113 protected:
115  ~vtkSTLWriter() override;
116 
117  void WriteData() override;
118 
119  void WriteBinarySTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
120  void WriteAsciiSTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
121 
122  char* FileName;
123  char* Header;
125  int FileType;
126 
128 
129 private:
130  vtkSTLWriter(const vtkSTLWriter&) = delete;
131  void operator=(const vtkSTLWriter&) = delete;
132 };
133 
134 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:290
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:143
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
write stereo lithography files
Definition: vtkSTLWriter.h:61
static vtkSTLWriter * New()
vtkPolyData * GetInput(int port)
Get the input to this writer.
virtual void SetBinaryHeader(vtkUnsignedCharArray *binaryHeader)
Set binary header for the file.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkSTLWriter() override
char * FileName
Definition: vtkSTLWriter.h:122
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void WriteAsciiSTL(vtkPoints *pts, vtkCellArray *polys, vtkCellArray *strips)
void SetFileTypeToASCII()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkSTLWriter.h:109
vtkSetFilePathMacro(FileName)
Specify file name of vtk polygon data file to write.
vtkPolyData * GetInput()
Get the input to this writer.
void SetFileTypeToBinary()
Specify file type (ASCII or BINARY) for vtk data file.
Definition: vtkSTLWriter.h:110
vtkUnsignedCharArray * BinaryHeader
Definition: vtkSTLWriter.h:124
vtkGetFilePathMacro(FileName)
Specify file name of vtk polygon data file to write.
void WriteData() override
void WriteBinarySTL(vtkPoints *pts, vtkCellArray *polys, vtkCellArray *strips)
dynamic, self-adjusting array of unsigned char
abstract class to write data to file(s)
Definition: vtkWriter.h:43
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
#define VTK_BINARY
Definition: vtkWriter.h:40
#define VTK_ASCII
Definition: vtkWriter.h:39