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 | Save3MF (std::ostream &str) const |
Saves the mesh object into a 3MF file. More... | |
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 | SaveAsymptote (std::ostream &rstrOut) const |
Saves the mesh object into an asymptote 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... | |
bool | SaveX3DOM (std::ostream &rstrOut) const |
Writes an X3dom 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 () |
Static Public Member Functions | |
static MeshIO::Format | GetFormat (const char *FileName) |
Determine the mesh format by file extension. More... | |
static void | SetAsymptoteSize (const std::string &, const std::string &) |
Change the image size of the asymptote output. 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 Member Functions | |
bool | Save3MFContent (std::ostream &str) const |
bool | Save3MFModel (std::ostream &str) const |
bool | Save3MFRels (std::ostream &str) const |
bool | SaveX3DContent (std::ostream &rstrOut, bool exportViewpoints) const |
Writes an X3D file. More... | |
Protected Attributes | |
bool | apply_transform |
std::string | objectName |
Static Protected Attributes | |
static std::string | asyHeight = "500" |
static std::string | asyWidth = "500" |
static std::string | stl_header |
The MeshOutput class is able to write a mesh object to an output stream on various formats.
MeshCore::MeshOutput::MeshOutput | ( | const MeshKernel & | rclM | ) |
MeshCore::MeshOutput::MeshOutput | ( | const MeshKernel & | rclM, |
const Material * | m | ||
) |
|
virtual |
|
static |
Determine the mesh format by file extension.
References MeshCore::MeshIO::AMF, MeshCore::MeshIO::ASTL, MeshCore::MeshIO::ASY, 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::ThreeMF, MeshCore::MeshIO::Undefined, MeshCore::MeshIO::VRML, MeshCore::MeshIO::WRZ, MeshCore::MeshIO::X3D, MeshCore::MeshIO::X3DOM, and MeshCore::MeshIO::X3DZ.
Referenced by MeshGui::ViewProviderMesh::exportMesh(), Mesh::MeshObject::load(), Mesh::MeshObject::save(), and SaveAny().
bool MeshOutput::Save3MF | ( | std::ostream & | str | ) | const |
Saves the mesh object into a 3MF file.
References zipios::ZipOutputStream::closeEntry(), zipios::ZipOutputStream::putNextEntry(), Save3MFContent(), Save3MFModel(), and Save3MFRels().
Referenced by SaveAny(), and SaveFormat().
|
protected |
References apply_transform, Base::blanks(), Base::Vector3< _Precision >::Set(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by Save3MF().
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::ASY, 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, Save3MF(), SaveAsciiPLY(), SaveAsciiSTL(), SaveAsymptote(), SaveBinaryPLY(), SaveBinarySTL(), SaveIDTF(), SaveInventor(), SaveMGL(), SaveNastran(), SaveOBJ(), SaveOFF(), SavePython(), SaveSMF(), SaveVRML(), SaveX3D(), SaveX3DOM(), SetObjectName(), MeshCore::MeshIO::SMF, MeshCore::MeshIO::ThreeMF, Transform(), MeshCore::MeshIO::Undefined, MeshCore::MeshIO::VRML, MeshCore::MeshIO::WRZ, MeshCore::MeshIO::X3D, MeshCore::MeshIO::X3DOM, and MeshCore::MeshIO::X3DZ.
Referenced by Mesh::MeshObject::save().
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().
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().
bool MeshOutput::SaveAsymptote | ( | std::ostream & | rstrOut | ) | const |
Saves the mesh object into an asymptote file.
Saves an Asymptote file.
References asyHeight, asyWidth, App::Color::b, MeshCore::MeshFacetIterator::End(), App::Color::g, Base::BoundBox3< _Precision >::GetCenter(), Base::BoundBox3< _Precision >::LengthX(), Base::BoundBox3< _Precision >::LengthY(), Base::BoundBox3< _Precision >::LengthZ(), MeshCore::MeshIO::OVERALL, MeshCore::MeshIO::PER_FACE, MeshCore::MeshIO::PER_VERTEX, App::Color::r, Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveAny(), and SaveFormat().
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().
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().
bool MeshOutput::SaveCadmouldFE | ( | std::ostream & | rstrOut | ) | const |
Writes a Cadmould FE file.
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::ASY, 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, Save3MF(), SaveAsciiPLY(), SaveAsciiSTL(), SaveAsymptote(), SaveBinaryPLY(), SaveBinarySTL(), SaveIDTF(), SaveInventor(), SaveMGL(), SaveNastran(), SaveOBJ(), SaveOFF(), SavePython(), SaveSMF(), SaveVRML(), SaveX3D(), SaveX3DOM(), MeshCore::MeshIO::SMF, MeshCore::MeshIO::ThreeMF, MeshCore::MeshIO::VRML, MeshCore::MeshIO::WRZ, MeshCore::MeshIO::X3D, and MeshCore::MeshIO::X3DOM.
Referenced by Mesh::MeshObject::save().
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().
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().
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.
bool MeshOutput::SaveMGL | ( | std::ostream & | rstrOut | ) | const |
Writes an MGL file.
Referenced by SaveAny(), and SaveFormat().
bool MeshOutput::SaveMTL | ( | std::ostream & | rstrOut | ) | const |
Saves the materials of an OBJ file.
References MeshCore::MeshIO::PER_FACE.
Referenced by Mesh::MeshObject::save().
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().
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().
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().
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().
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().
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().
bool MeshOutput::SaveX3D | ( | std::ostream & | rstrOut | ) | const |
Writes an X3D file.
References DraftVecUtils::angle(), apply_transform, App::Color::b, Base::BoundBox3< _Precision >::CalcDiagonalLength(), DraftVecUtils::dist(), App::Color::g, Base::BoundBox3< _Precision >::GetCenter(), MeshCore::MeshIO::PER_FACE, MeshCore::MeshIO::PER_VERTEX, App::Color::r, Base::BoundBox3< _Precision >::Transformed(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
Referenced by SaveX3D(), and SaveX3DOM().
bool MeshOutput::SaveX3DOM | ( | std::ostream & | rstrOut | ) | const |
Writes an X3dom file.
Writes an X3DOM file.
References SaveX3DContent().
Referenced by SaveAny(), and SaveFormat().
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().
|
static |
Change the image size of the asymptote output.
References asyHeight, and asyWidth.
Referenced by MeshGui::DlgSettingsImportExport::saveSettings().
void MeshCore::MeshOutput::SetGroups | ( | const std::vector< Group > & | g | ) |
Referenced by Mesh::MeshObject::save().
void MeshCore::MeshOutput::SetObjectName | ( | const std::string & | n | ) |
Referenced by Mesh::MeshObject::save(), and SaveAny().
|
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.
|
static |
void MeshOutput::Transform | ( | const Base::Matrix4D & | mat | ) |
References apply_transform.
Referenced by Mesh::MeshObject::save(), and SaveAny().
|
protected |
Referenced by Save3MFModel(), SaveAsciiPLY(), SaveBinaryPLY(), SaveMeshNode(), SaveOBJ(), SaveOFF(), SaveSMF(), SaveX3DContent(), SaveXML(), and Transform().
|
staticprotected |
Referenced by SaveAsymptote(), and SetAsymptoteSize().
|
staticprotected |
Referenced by SaveAsymptote(), and SetAsymptoteSize().
|
protected |
Referenced by SaveAny(), SaveAsciiSTL(), and SaveIDTF().
|
staticprotected |
Referenced by SaveBinarySTL(), and SetSTLHeaderData().