Core routines used when reading/writing STL files. More...
Public Types | |
enum | STLFormat { ASCII , BINARY , UNKNOWN } |
Enumeration for the format of data in the stream. More... | |
Protected Member Functions | |
STLCore ()=default | |
Default construct. More... | |
Static Protected Member Functions | |
static bool | isBinaryName (const fileName &filename, const STLFormat format) |
Detect 'stlb' extension as binary when format = UNKNOWN. More... | |
static int | detectBinaryHeader (const fileName &filename) |
Check contents to detect if the file is a binary STL. More... | |
static std::unique_ptr< std::istream > | readBinaryHeader (const fileName &filename, label &nTrisEstimated) |
Read STL binary file header. More... | |
static void | writeBinaryHeader (ostream &os, uint32_t nTris) |
Write STL binary file and number of triangles to stream. More... | |
Core routines used when reading/writing STL files.
enum STLFormat |
|
protecteddefault |
Default construct.
Detect 'stlb' extension as binary when format = UNKNOWN.
Otherwise test if format == BINARY.
Definition at line 66 of file STLCore.C.
References STLCore::BINARY, format(), fileName::hasExt(), and STLCore::UNKNOWN.
|
staticprotected |
Check contents to detect if the file is a binary STL.
Return the estimated number of triangles or 0 on error.
Definition at line 87 of file STLCore.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::fileSize(), startsWithSolid(), STLHeaderSize, IOstreamOption::UNCOMPRESSED, and ifstreamPointer::whichCompression().
|
staticprotected |
Read STL binary file header.
Return the opened file stream and estimated number of triangles. The stream is invalid and number of triangles is 0 on error.
Definition at line 147 of file STLCore.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::fileSize(), ifstreamPointer::release(), STLHeaderSize, IOstreamOption::UNCOMPRESSED, and ifstreamPointer::whichCompression().
|
staticprotected |
Write STL binary file and number of triangles to stream.
Definition at line 226 of file STLCore.C.
References os(), and STLHeaderSize.