VTK  9.2.6
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 =========================================================================*/
52 #ifndef vtkSTLWriter_h
53 #define vtkSTLWriter_h
54 
55 #include "vtkIOGeometryModule.h" // For export macro
56 #include "vtkWriter.h"
57 
58 class vtkCellArray;
59 class vtkPoints;
60 class vtkPolyData;
62 
63 class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkWriter
64 {
65 public:
66  static vtkSTLWriter* New();
67  vtkTypeMacro(vtkSTLWriter, vtkWriter);
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
71 
77 
79 
85 
87 
91  vtkSetStringMacro(Header);
92  vtkGetStringMacro(Header);
94 
96 
102  virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
103  vtkGetObjectMacro(BinaryHeader, vtkUnsignedCharArray);
105 
107 
110  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
111  vtkGetMacro(FileType, int);
112  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
113  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
115 
116 protected:
118  ~vtkSTLWriter() override;
119 
120  void WriteData() override;
121 
122  void WriteBinarySTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
123  void WriteAsciiSTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
124 
125  char* FileName;
126  char* Header;
128  int FileType;
129 
131 
132 private:
133  vtkSTLWriter(const vtkSTLWriter&) = delete;
134  void operator=(const vtkSTLWriter&) = delete;
135 };
136 
137 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:296
a simple class to control print indentation
Definition: vtkIndent.h:119
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:149
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
write stereo lithography files
Definition: vtkSTLWriter.h:64
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:125
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:112
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:113
vtkUnsignedCharArray * BinaryHeader
Definition: vtkSTLWriter.h:127
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:46
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
#define VTK_BINARY
Definition: vtkWriter.h:43
#define VTK_ASCII
Definition: vtkWriter.h:42