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 =========================================================================*/
42 #ifndef vtkSTLWriter_h
43 #define vtkSTLWriter_h
44 
45 #include "vtkIOGeometryModule.h" // For export macro
46 #include "vtkWriter.h"
47 
48 class vtkCellArray;
49 class vtkPoints;
50 class vtkPolyData;
52 
53 class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkWriter
54 {
55 public:
56  static vtkSTLWriter* New();
57  vtkTypeMacro(vtkSTLWriter, vtkWriter);
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
61 
67 
69 
75 
77 
81  vtkSetStringMacro(Header);
82  vtkGetStringMacro(Header);
84 
86 
92  virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
93  vtkGetObjectMacro(BinaryHeader, vtkUnsignedCharArray);
95 
97 
100  vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
101  vtkGetMacro(FileType, int);
102  void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
103  void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
105 
106 protected:
108  ~vtkSTLWriter() override;
109 
110  void WriteData() override;
111 
112  void WriteBinarySTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
113  void WriteAsciiSTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
114 
115  char* FileName;
116  char* Header;
118  int FileType;
119 
121 
122 private:
123  vtkSTLWriter(const vtkSTLWriter&) = delete;
124  void operator=(const vtkSTLWriter&) = delete;
125 };
126 
127 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:196
a simple class to control print indentation
Definition: vtkIndent.h:49
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition: vtkPoints.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
write stereo lithography files
Definition: vtkSTLWriter.h:54
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:115
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:102
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:103
vtkUnsignedCharArray * BinaryHeader
Definition: vtkSTLWriter.h:117
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