VTK  9.3.0
vtkSTLWriter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
21#ifndef vtkSTLWriter_h
22#define vtkSTLWriter_h
23
24#include "vtkIOGeometryModule.h" // For export macro
25#include "vtkWriter.h"
26
27VTK_ABI_NAMESPACE_BEGIN
28class vtkCellArray;
29class vtkPoints;
30class vtkPolyData;
32
33class VTKIOGEOMETRY_EXPORT vtkSTLWriter : public vtkWriter
34{
35public:
36 static vtkSTLWriter* New();
37 vtkTypeMacro(vtkSTLWriter, vtkWriter);
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
41
47
49
55
57
61 vtkSetStringMacro(Header);
62 vtkGetStringMacro(Header);
64
66
72 virtual void SetBinaryHeader(vtkUnsignedCharArray* binaryHeader);
73 vtkGetObjectMacro(BinaryHeader, vtkUnsignedCharArray);
75
77
80 vtkSetClampMacro(FileType, int, VTK_ASCII, VTK_BINARY);
81 vtkGetMacro(FileType, int);
82 void SetFileTypeToASCII() { this->SetFileType(VTK_ASCII); }
83 void SetFileTypeToBinary() { this->SetFileType(VTK_BINARY); }
85
86protected:
88 ~vtkSTLWriter() override;
89
90 void WriteData() override;
91
93 void WriteAsciiSTL(vtkPoints* pts, vtkCellArray* polys, vtkCellArray* strips);
94
95 char* FileName;
96 char* Header;
99
100 int FillInputPortInformation(int port, vtkInformation* info) override;
101
102private:
103 vtkSTLWriter(const vtkSTLWriter&) = delete;
104 void operator=(const vtkSTLWriter&) = delete;
105};
106
107VTK_ABI_NAMESPACE_END
108#endif
object to represent cell connectivity
a simple class to control print indentation
Definition vtkIndent.h:29
Store vtkAlgorithm input/output information.
represent and manipulate 3D points
Definition vtkPoints.h:29
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
write stereo lithography files
virtual void SetBinaryHeader(vtkUnsignedCharArray *binaryHeader)
Set binary header for the file.
vtkPolyData * GetInput(int port)
Get the input to this writer.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkSTLWriter() override
char * FileName
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.
static vtkSTLWriter * New()
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.
vtkUnsignedCharArray * BinaryHeader
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:32
#define VTK_BINARY
Definition vtkWriter.h:29
#define VTK_ASCII
Definition vtkWriter.h:28