ASCII and Binary Stereo Lithography File writers. More...
#include <WriteSTL.hpp>
Public Member Functions | |
WriteSTL (Interface *impl) | |
Constructor. More... | |
virtual | ~WriteSTL () |
Destructor. More... | |
ErrorCode | write_file (const char *file_name, const bool overwrite, const FileOptions &opts, const EntityHandle *output_list, const int num_sets, const std::vector< std::string > &qa_list, const Tag *tag_list=NULL, int num_tags=0, int export_dimension=3) |
writes out a file More... | |
Public Member Functions inherited from moab::WriterIface | |
virtual | ~WriterIface () |
Static Public Member Functions | |
static WriterIface * | factory (Interface *) |
factory method forSTL writer More... | |
Protected Types | |
enum | ByteOrder { STL_BIG_ENDIAN , STL_LITTLE_ENDIAN , STL_UNKNOWN_BYTE_ORDER } |
Protected Member Functions | |
ErrorCode | ascii_write_triangles (FILE *file, const char header[81], const Range &triangles, int precision) |
Write list of triangles to an STL file. More... | |
ErrorCode | binary_write_triangles (FILE *file, const char header[81], ByteOrder byte_order, const Range &triangles) |
Write list of triangles to an STL file. More... | |
ErrorCode | get_triangle_data (const double vtx_coords[9], float v1[3], float v2[3], float v3[3], float n[3]) |
Given an array of vertex coordinates for a triangle, pass back individual point coordinates as floats and calculate triangle normal. More... | |
ErrorCode | get_triangle_data (const double vtx_coords[9], CartVect &v1, CartVect &v2, CartVect &v3, CartVect &n) |
Protected Attributes | |
Interface * | mbImpl |
interface instance More... | |
WriteUtilIface * | mWriteIface |
Private Member Functions | |
ErrorCode | make_header (char header[81], const std::vector< std::string > &qa_list) |
Construct 80-byte, null-terminated description string from qa_list. Unused space in header will be null-char padded. More... | |
ErrorCode | get_triangles (const EntityHandle *set_array, int set_array_length, Range &triangles) |
Get triangles to write from input array of entity sets. If no sets, gets all triangles. More... | |
FILE * | open_file (const char *name, bool overwrite, bool binary) |
Open a file, respecting passed overwrite value and subclass-specified value for need_binary_io(). More... | |
ASCII and Binary Stereo Lithography File writers.
This writer will write only the MBTRI elements in the mesh. It will not decompose other 2-D elements into triangles, nor will it skin the mesh or do any other high-level operation to generate triangles from 3-D elements.
Binary files will be written with a little-endian byte order by default. The byte order can be controlled with writer options.
Definition at line 42 of file WriteSTL.hpp.
|
protected |
Enumerator | |
---|---|
STL_BIG_ENDIAN | |
STL_LITTLE_ENDIAN | |
STL_UNKNOWN_BYTE_ORDER |
Definition at line 67 of file WriteSTL.hpp.
WriteSTL::WriteSTL | ( | Interface * | impl | ) |
Constructor.
Definition at line 59 of file WriteSTL.cpp.
References mWriteIface, and moab::Interface::query_interface().
Referenced by factory().
|
virtual |
Destructor.
Definition at line 64 of file WriteSTL.cpp.
References mbImpl, mWriteIface, and moab::Interface::release_interface().
|
protected |
Write list of triangles to an STL file.
Definition at line 234 of file WriteSTL.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), get_triangle_data(), MB_FILE_WRITE_ERROR, MB_SUCCESS, and mbImpl.
Referenced by write_file().
|
protected |
Write list of triangles to an STL file.
Definition at line 284 of file WriteSTL.cpp.
References moab::Range::begin(), moab::SysUtil::byteswap(), moab::Range::end(), ErrorCode, moab::Interface::get_connectivity(), moab::Interface::get_coords(), get_triangle_data(), moab::SysUtil::little_endian(), MB_FILE_WRITE_ERROR, MB_SUCCESS, mbImpl, moab::BinTri::normal, moab::BinTri::pad, moab::Range::size(), STL_BIG_ENDIAN, moab::SysUtil::swap_bytes(), moab::BinTri::vertex1, moab::BinTri::vertex2, and moab::BinTri::vertex3.
Referenced by write_file().
|
static |
factory method forSTL writer
Definition at line 54 of file WriteSTL.cpp.
References iface, and WriteSTL().
Referenced by moab::ReaderWriterSet::ReaderWriterSet().
|
protected |
Definition at line 221 of file WriteSTL.cpp.
References MB_SUCCESS, and moab::CartVect::normalize().
|
protected |
Given an array of vertex coordinates for a triangle, pass back individual point coordinates as floats and calculate triangle normal.
Definition at line 207 of file WriteSTL.cpp.
References ErrorCode, moab::CartVect::get(), and MB_SUCCESS.
Referenced by ascii_write_triangles(), and binary_write_triangles().
|
private |
Get triangles to write from input array of entity sets. If no sets, gets all triangles.
Definition at line 190 of file WriteSTL.cpp.
References ErrorCode, moab::Interface::get_entities_by_type(), MB_SUCCESS, mbImpl, MBTRI, and moab::Range::merge().
Referenced by write_file().
|
private |
Construct 80-byte, null-terminated description string from qa_list. Unused space in header will be null-char padded.
Definition at line 172 of file WriteSTL.cpp.
References MB_SUCCESS.
Referenced by write_file().
|
private |
Open a file, respecting passed overwrite value and subclass-specified value for need_binary_io().
Definition at line 134 of file WriteSTL.cpp.
References _S_IREAD, _S_IWRITE, and MB_SET_ERR_RET_VAL.
Referenced by write_file().
|
virtual |
writes out a file
Implements moab::WriterIface.
Definition at line 69 of file WriteSTL.cpp.
References ascii_write_triangles(), moab::SysUtil::big_endian(), binary_write_triangles(), moab::DEFAULT_PRECISION, moab::Range::empty(), ErrorCode, moab::FileOptions::get_int_option(), moab::FileOptions::get_null_option(), get_triangles(), moab::SysUtil::little_endian(), make_header(), MB_ENTITY_NOT_FOUND, MB_FILE_DOES_NOT_EXIST, MB_SET_ERR, MB_SUCCESS, MB_TYPE_OUT_OF_RANGE, open_file(), STL_BIG_ENDIAN, STL_LITTLE_ENDIAN, and STL_UNKNOWN_BYTE_ORDER.
|
protected |
interface instance
Definition at line 87 of file WriteSTL.hpp.
Referenced by ascii_write_triangles(), binary_write_triangles(), get_triangles(), and ~WriteSTL().
|
protected |
Definition at line 88 of file WriteSTL.hpp.
Referenced by WriteSTL(), and ~WriteSTL().