The MeshOutput class is able to write a mesh object to an output stream on various formats. More...
#include <MeshIO.h>
Public Member Functions | |
MeshOutput (const MeshKernel &rclM) | |
MeshOutput (const MeshKernel &rclM, const Material *m) | |
bool | SaveAny (const char *FileName, MeshIO::Format f=MeshIO::Undefined) const |
Saves the file, decided by extension if not explicitly given. More... | |
bool | SaveAsciiPLY (std::ostream &rstrOut) const |
Saves the mesh object into an ASCII PLY file. More... | |
bool | SaveAsciiSTL (std::ostream &rstrOut) const |
Saves the mesh object into an ASCII STL file. More... | |
bool | SaveBinaryPLY (std::ostream &rstrOut) const |
Saves the mesh object into a binary PLY file. More... | |
bool | SaveBinarySTL (std::ostream &rstrOut) const |
Saves the mesh object into a binary STL file. More... | |
bool | SaveCadmouldFE (std::ostream &rstrOut) const |
Writes a Cadmould FE file. More... | |
bool | SaveFormat (std::ostream &str, MeshIO::Format fmt) const |
Saves to a stream and the given format. More... | |
bool | SaveIDTF (std::ostream &rstrOut) const |
Writes an IDTF file. More... | |
bool | SaveInventor (std::ostream &rstrOut) const |
Writes an OpenInventor file. More... | |
bool | SaveMeshNode (std::ostream &rstrIn) |
Saves a node to an OpenInventor file. More... | |
bool | SaveMGL (std::ostream &rstrOut) const |
Writes an MGL file. More... | |
bool | SaveMTL (std::ostream &rstrOut) const |
Saves the materials of an OBJ file. More... | |
bool | SaveNastran (std::ostream &rstrOut) const |
Writes a Nastran file. More... | |
bool | SaveOBJ (std::ostream &rstrOut) const |
Saves the mesh object into an OBJ file. More... | |
bool | SaveOFF (std::ostream &rstrOut) const |
Saves the mesh object into an OFF file. More... | |
bool | SavePython (std::ostream &rstrOut) const |
Writes a python module which creates a mesh. More... | |
bool | SaveSMF (std::ostream &rstrOut) const |
Saves the mesh object into an SMF file. More... | |
bool | SaveVRML (std::ostream &rstrOut) const |
Writes a VRML file. More... | |
bool | SaveX3D (std::ostream &rstrOut) const |
Writes an X3D file. More... | |
void | SaveXML (Base::Writer &writer) const |
Saves the mesh object into an XML file. More... | |
void | SetGroups (const std::vector< Group > &g) |
void | SetObjectName (const std::string &n) |
void | Transform (const Base::Matrix4D &) |
virtual | ~MeshOutput (void) |
Static Public Member Functions | |
static MeshIO::Format | GetFormat (const char *FileName) |
Determine the mesh format by file extension. More... | |
static void | SetSTLHeaderData (const std::string &) |
Set custom data to the header of a binary STL. More... | |
static std::vector< std::string > | supportedMeshFormats () |
Protected Attributes | |
bool | apply_transform |
std::string | objectName |
Static Protected Attributes | |
static std::string | stl_header |
Detailed Description
The MeshOutput class is able to write a mesh object to an output stream on various formats.
Constructor & Destructor Documentation
◆ MeshOutput() [1/2]
MeshCore::MeshOutput::MeshOutput | ( | const MeshKernel & | rclM | ) |
◆ MeshOutput() [2/2]
MeshCore::MeshOutput::MeshOutput | ( | const MeshKernel & | rclM, |
const Material * | m | ||
) |
◆ ~MeshOutput()
|
virtual |
Member Function Documentation
◆ GetFormat()
|
static |
Determine the mesh format by file extension.
References MeshCore::MeshIO::AMF, MeshCore::MeshIO::ASTL, MeshCore::MeshIO::BMS, MeshCore::MeshIO::BSTL, MeshCore::MeshIO::IDTF, MeshCore::MeshIO::IV, MeshCore::MeshIO::MGL, MeshCore::MeshIO::NAS, MeshCore::MeshIO::OBJ, MeshCore::MeshIO::OFF, MeshCore::MeshIO::PLY, MeshCore::MeshIO::PY, MeshCore::MeshIO::SMF, MeshCore::MeshIO::Undefined, MeshCore::MeshIO::VRML, MeshCore::MeshIO::WRZ, and MeshCore::MeshIO::X3D.
Referenced by MeshGui::ViewProviderMesh::exportMesh(), Mesh::MeshObject::load(), Mesh::MeshObject::save(), and SaveAny().
◆ SaveAny()
bool MeshOutput::SaveAny | ( | const char * | FileName, |
MeshIO::Format | f = MeshIO::Undefined |
||
) | const |
Saves the file, decided by extension if not explicitly given.
Save in a file, format is decided by the extension if not explicitly given.
References MeshCore::MeshIO::APLY, MeshCore::MeshIO::ASTL, MeshCore::MeshIO::BMS, MeshCore::MeshIO::BSTL, Base::FileInfo::exists(), GetFormat(), MeshCore::MeshIO::IDTF, Base::FileInfo::isWritable(), MeshCore::MeshIO::IV, MeshCore::MeshIO::MGL, MeshCore::MeshIO::NAS, MeshCore::MeshIO::OBJ, objectName, MeshCore::MeshIO::OFF, MeshCore::MeshIO::PLY, MeshCore::MeshIO::PY, SaveAsciiPLY(), SaveAsciiSTL(), SaveBinaryPLY(), SaveBinarySTL(), SaveIDTF(), SaveInventor(), SaveMGL(), SaveNastran(), SaveOBJ(), SaveOFF(), SavePython(), SaveSMF(), SaveVRML(), SaveX3D(), SetObjectName(), MeshCore::MeshIO::SMF, Transform(), MeshCore::MeshIO::Undefined, MeshCore::MeshIO::VRML, MeshCore::MeshIO::WRZ, and MeshCore::MeshIO::X3D.
Referenced by Mesh::MeshObject::save().
◆ SaveAsciiPLY()
bool MeshOutput::SaveAsciiPLY | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into an ASCII PLY file.
References apply_transform, MeshCore::MeshIO::PER_VERTEX, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveAsciiSTL()
bool MeshOutput::SaveAsciiSTL | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into an ASCII STL file.
Saves the mesh object into an ASCII file.
References MeshCore::MeshFacetIterator::End(), MeshCore::MeshGeomFacet::GetNormal(), Base::SequencerLauncher::next(), objectName, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveBinaryPLY()
bool MeshOutput::SaveBinaryPLY | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into a binary PLY file.
References apply_transform, Base::Stream::LittleEndian, MeshCore::MeshIO::PER_VERTEX, Base::Stream::setByteOrder(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveBinarySTL()
bool MeshOutput::SaveBinarySTL | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into a binary STL file.
Saves the mesh object into a binary file.
References MeshCore::MeshFacetIterator::End(), MeshCore::MeshGeomFacet::GetNormal(), Base::SequencerLauncher::next(), stl_header, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), SaveFormat(), and MeshGui::RemeshGmsh::writeProject().
◆ SaveCadmouldFE()
bool MeshOutput::SaveCadmouldFE | ( | std::ostream & | rstrOut | ) | const |
Writes a Cadmould FE file.
◆ SaveFormat()
bool MeshOutput::SaveFormat | ( | std::ostream & | str, |
MeshIO::Format | fmt | ||
) | const |
Saves to a stream and the given format.
References MeshCore::MeshIO::APLY, MeshCore::MeshIO::ASTL, MeshCore::MeshIO::BMS, MeshCore::MeshIO::BSTL, MeshCore::MeshIO::IDTF, MeshCore::MeshIO::IV, MeshCore::MeshIO::MGL, MeshCore::MeshIO::NAS, MeshCore::MeshIO::OBJ, MeshCore::MeshIO::OFF, MeshCore::MeshIO::PLY, MeshCore::MeshIO::PY, SaveAsciiPLY(), SaveAsciiSTL(), SaveBinaryPLY(), SaveBinarySTL(), SaveIDTF(), SaveInventor(), SaveMGL(), SaveNastran(), SaveOBJ(), SaveOFF(), SavePython(), SaveSMF(), SaveVRML(), SaveX3D(), MeshCore::MeshIO::SMF, MeshCore::MeshIO::VRML, MeshCore::MeshIO::WRZ, and MeshCore::MeshIO::X3D.
Referenced by Mesh::MeshObject::save().
◆ SaveIDTF()
bool MeshOutput::SaveIDTF | ( | std::ostream & | rstrOut | ) | const |
Writes an IDTF file.
References objectName, Base::tabs(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveInventor()
bool MeshOutput::SaveInventor | ( | std::ostream & | rstrOut | ) | const |
Writes an OpenInventor file.
References Base::InventorBuilder::addIndexedFaceSet(), Base::InventorBuilder::addInfo(), Base::InventorBuilder::addLabel(), Base::InventorBuilder::addNormalBinding(), Base::InventorBuilder::addPoint(), Base::InventorBuilder::beginNormal(), Base::InventorBuilder::beginPoints(), Base::InventorBuilder::beginSeparator(), MeshCore::MeshFacetIterator::End(), MeshCore::MeshPointIterator::End(), Base::InventorBuilder::endNormal(), Base::InventorBuilder::endPoints(), Base::InventorBuilder::endSeparator(), MeshCore::MeshGeomFacet::GetNormal(), and Base::SequencerLauncher::next().
Referenced by SaveAny(), and SaveFormat().
◆ SaveMeshNode()
bool MeshOutput::SaveMeshNode | ( | std::ostream & | rstrIn | ) |
Saves a node to an OpenInventor file.
References apply_transform, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
◆ SaveMGL()
bool MeshOutput::SaveMGL | ( | std::ostream & | rstrOut | ) | const |
Writes an MGL file.
Referenced by SaveAny(), and SaveFormat().
◆ SaveMTL()
bool MeshOutput::SaveMTL | ( | std::ostream & | rstrOut | ) | const |
Saves the materials of an OBJ file.
References MeshCore::MeshIO::PER_FACE.
Referenced by Mesh::MeshObject::save().
◆ SaveNastran()
bool MeshOutput::SaveNastran | ( | std::ostream & | rstrOut | ) | const |
Writes a Nastran file.
References MeshCore::MeshFacetIterator::GetIndices(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshPointIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshPointIterator::More(), MeshCore::MeshFacetIterator::Next(), MeshCore::MeshPointIterator::Next(), Base::SequencerLauncher::next(), MeshCore::MeshPointIterator::Transform(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveOBJ()
bool MeshOutput::SaveOBJ | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into an OBJ file.
Saves an OBJ file.
References apply_transform, Base::Console(), MeshCore::MeshFacetIterator::End(), Base::Tools::escapedUnicodeFromUtf8(), DraftVecUtils::find(), MeshCore::MeshGeomFacet::GetNormal(), Base::SequencerLauncher::next(), MeshCore::MeshIO::OVERALL, MeshCore::MeshIO::PER_FACE, MeshCore::MeshIO::PER_VERTEX, Base::Vector3< _Precision >::Set(), Base::ConsoleSingleton::Warning(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveOFF()
bool MeshOutput::SaveOFF | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into an OFF file.
Saves an OFF file.
References apply_transform, Base::Console(), Base::SequencerLauncher::next(), MeshCore::MeshIO::OVERALL, MeshCore::MeshIO::PER_FACE, MeshCore::MeshIO::PER_VERTEX, Base::Vector3< _Precision >::Set(), Base::ConsoleSingleton::Warning(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SavePython()
bool MeshOutput::SavePython | ( | std::ostream & | rstrOut | ) | const |
Writes a python module which creates a mesh.
Writes a Python module.
References MeshCore::MeshFacetIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshFacetIterator::Next(), and MeshCore::MeshFacetIterator::Transform().
Referenced by SaveAny(), and SaveFormat().
◆ SaveSMF()
bool MeshOutput::SaveSMF | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into an SMF file.
Saves an SMF file.
References apply_transform, Base::SequencerLauncher::next(), Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveVRML()
bool MeshOutput::SaveVRML | ( | std::ostream & | rstrOut | ) | const |
Writes a VRML file.
References MeshCore::MeshFacetIterator::GetIndices(), MeshCore::MeshFacetIterator::Init(), MeshCore::MeshPointIterator::Init(), MeshCore::MeshFacetIterator::More(), MeshCore::MeshPointIterator::More(), MeshCore::MeshFacetIterator::Next(), MeshCore::MeshPointIterator::Next(), Base::SequencerLauncher::next(), MeshCore::MeshIO::OVERALL, MeshCore::MeshIO::PER_VERTEX, App::Color::r, MeshCore::MeshFacetIterator::Transform(), MeshCore::MeshPointIterator::Transform(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveX3D()
bool MeshOutput::SaveX3D | ( | std::ostream & | rstrOut | ) | const |
Writes an X3D file.
References DraftVecUtils::angle(), apply_transform, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
◆ SaveXML()
void MeshOutput::SaveXML | ( | Base::Writer & | writer | ) | const |
Saves the mesh object into an XML file.
References apply_transform, Base::Writer::decInd(), Base::Writer::incInd(), Base::Writer::ind(), Base::Writer::Stream(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by Mesh::PropertyMeshKernel::Save().
◆ SetGroups()
void MeshCore::MeshOutput::SetGroups | ( | const std::vector< Group > & | g | ) |
Referenced by Mesh::MeshObject::save().
◆ SetObjectName()
void MeshCore::MeshOutput::SetObjectName | ( | const std::string & | n | ) |
Referenced by Mesh::MeshObject::save(), and SaveAny().
◆ SetSTLHeaderData()
|
static |
Set custom data to the header of a binary STL.
If the data exceeds 80 characters then the characters too much are ignored. If the data has less than 80 characters they are automatically filled up with spaces.
References stl_header.
◆ supportedMeshFormats()
|
static |
◆ Transform()
void MeshOutput::Transform | ( | const Base::Matrix4D & | mat | ) |
References apply_transform.
Referenced by Mesh::MeshObject::save(), and SaveAny().
Member Data Documentation
◆ apply_transform
|
protected |
Referenced by SaveAsciiPLY(), SaveBinaryPLY(), SaveMeshNode(), SaveOBJ(), SaveOFF(), SaveSMF(), SaveX3D(), SaveXML(), and Transform().
◆ objectName
|
protected |
Referenced by SaveAny(), SaveAsciiSTL(), and SaveIDTF().
◆ stl_header
|
staticprotected |
Referenced by SaveBinarySTL(), and SetSTLHeaderData().
The documentation for this class was generated from the following files:
- src/Mod/Mesh/App/Core/MeshIO.h
- src/Mod/Mesh/App/Core/MeshIO.cpp