Class for writing ASCII and binary STL files.
More...
|
enum | WriteMode { WriteOverwrite
, WriteAppend
} |
|
enum | Format { FormatUnknown = -1
, FormatASCII
, FormatBinary
} |
|
|
| STLWriter (const std::string &filename, Format format) |
|
int | writeBegin (WriteMode writeMode, bool partialWrite=false) |
|
int | writeEnd () |
|
int | writeFacet (const std::array< double, 3 > &V0, const std::array< double, 3 > &V1, const std::array< double, 3 > &V2, const std::array< double, 3 > &N) |
|
int | writeFooter (const std::string &name) |
|
int | writeHeader (const std::string &name, std::size_t nT) |
|
int | writeSolid (const std::string &name, std::size_t nV, std::size_t nT, const std::vector< std::array< double, 3 > > &V, const std::vector< std::array< double, 3 > > &N, const std::vector< std::array< std::size_t, 3 > > &T) |
|
int | writeSolid (const std::string &name, std::size_t nV, std::size_t nT, const std::vector< std::vector< double > > &V, const std::vector< std::vector< double > > &N, const std::vector< std::vector< std::size_t > > &T) |
|
const std::string & | getFilename () const |
|
Format | getFormat () const |
|
Class for writing ASCII and binary STL files.
Definition at line 156 of file STL.hpp.
◆ WriteMode
enum bitpit::STLWriter::WriteMode |
◆ STLWriter()
bitpit::STLWriter::STLWriter |
( |
const std::string & | filename, |
|
|
Format | format ) |
Constructor.
- Parameters
-
filename | is the name of the STL file |
format | is the format of the STL file |
Definition at line 1346 of file STL.cpp.
◆ writeBegin()
int bitpit::STLWriter::writeBegin |
( |
WriteMode | writeMode, |
|
|
bool | partialWrite = false ) |
Begin writing the file.
- Parameters
-
writeMode | is the write mode that will be used |
partialWrite | tells the writer that only part of the facets will be written, this can be used for writing a binary file incrementally |
- Returns
- Returns a negative number if an error occured, zero otherwise.
Definition at line 1362 of file STL.cpp.
◆ writeEnd()
int bitpit::STLWriter::writeEnd |
( |
| ) |
|
Close the current stream to STL file.
Definition at line 1403 of file STL.cpp.
◆ writeFacet()
int bitpit::STLWriter::writeFacet |
( |
const std::array< double, 3 > & | V0, |
|
|
const std::array< double, 3 > & | V1, |
|
|
const std::array< double, 3 > & | V2, |
|
|
const std::array< double, 3 > & | N ) |
Write the specified facet data to the STL file.
This routine assumes that the file stream is already open.
- Parameters
-
V0 | are the coordinates of the first vertex |
V1 | are the coordinates of the second vertex |
V2 | are the coordinates of the third vertex |
N | is the normal |
- Returns
- Returns a negative number if an error occured, zero otherwise. The meaning of the error codes is the following:
- error = -1: failed to write data to output stream
Definition at line 1542 of file STL.cpp.
◆ writeFooter()
int bitpit::STLWriter::writeFooter |
( |
const std::string & | name | ) |
|
Write the footer to the STL file.
This routine assumes that the file stream is already open.
- Parameters
-
name | is the name of the solid |
- Returns
- Returns a negative number if an error occured, zero otherwise. The meaning of the error codes is the following:
- error = -1: failed to write data to output stream
Definition at line 1515 of file STL.cpp.
◆ writeHeader()
int bitpit::STLWriter::writeHeader |
( |
const std::string & | name, |
|
|
std::size_t | nT ) |
Write the header to the STL file.
This routine assumes that the file stream is already open.
- Parameters
-
name | is the name of the solid |
nT | are the number of facets of the solid |
- Returns
- Returns a negative number if an error occured, zero otherwise. The meaning of the error codes is the following:
- error = -1: failed to write data to output stream
Definition at line 1491 of file STL.cpp.
◆ writeSolid()
int bitpit::STLWriter::writeSolid |
( |
const std::string & | name, |
|
|
std::size_t | nV, |
|
|
std::size_t | nT, |
|
|
const std::vector< std::array< double, 3 > > & | V, |
|
|
const std::vector< std::array< double, 3 > > & | N, |
|
|
const std::vector< std::array< std::size_t, 3 > > & | T ) |
Write the specified solid data to the STL file.
This routine assumes that the file stream is already open.
- Parameters
-
name | is the name of the solid |
nV | are the number of vertices of the solid |
nT | are the number of facets of the solid |
V | is the list of vertex coordinates |
N | is the list of facet normals |
T | is the facet->vertex connectivity |
- Returns
- Returns a negative number if an error occured, zero otherwise. The meaning of the error codes is the following:
- error = -1: failed to write data to output stream
- error = -2: input variable are not self-consistent
Definition at line 1426 of file STL.cpp.
The documentation for this class was generated from the following files:
---
layout: doxygen_footer
---