Mantid
|
Class to load and save .3mf files .3mf format is a 3D manufacturing format for storing mesh descriptions of multi-component objects + metadata about the overall model (eg scale) and the individual components. More...
#include <Mantid3MFFileIO.h>
Public Member Functions | |
void | LoadFile (std::string filename) |
Load 3MF format file. More... | |
Mantid3MFFileIO () | |
void | readMeshObjects (std::vector< MeshObject_sptr > &meshObjects, MeshObject_sptr &sample) |
Read a set of mesh objects from the in memory lib3mf model object. More... | |
void | saveFile (std::string filename) |
void | writeMeshObjects (std::vector< const Geometry::MeshObject * > meshObjects, MeshObject_const_sptr &sample, DataHandling::ScaleUnits scale) |
Public Member Functions inherited from Mantid::DataHandling::MeshFileIO | |
Kernel::V3D | createScaledV3D (double xVal, double yVal, double zVal) |
scales a 3D point according the units defined in the MeshFileIO class More... | |
ScaleUnits | getScaleType () |
std::shared_ptr< Geometry::MeshObject > | rotate (std::shared_ptr< Geometry::MeshObject > environmentMesh, double xRotation, double yRotation, double zRotation) |
Rotates the environment by a generated matrix. More... | |
std::shared_ptr< Geometry::MeshObject > | translate (std::shared_ptr< Geometry::MeshObject > environmentMesh, const std::vector< double > &translationVector) |
translates the environment by a provided matrix More... | |
Private Member Functions | |
void | AddBaseMaterial (std::string materialName, int materialColor, int &resourceID, Lib3MF_uint32 &materialPropertyID) |
int | generateRandomColor () |
MeshObject_sptr | loadMeshObject (Lib3MF::PMeshObject meshObject, sLib3MFTransform buildTransform) |
Load a single mesh object into a Mantid Geometry::MeshObject. More... | |
void | readComponents (std::vector< MeshObject_sptr > &meshObjects, MeshObject_sptr &sample, uint32_t objectResourceID, sLib3MFTransform transform) |
void | readMeshObject (std::vector< MeshObject_sptr > &meshObjects, MeshObject_sptr &sample, uint32_t objectResourceID, sLib3MFTransform transform) |
Attempt to read a single mesh from a specified lib3mf resource id. More... | |
void | setMaterialOnObject (std::string objectName, std::string materialName, int materialColor) |
void | writeMeshObject (const Geometry::MeshObject &meshObject, std::string name) |
Private Attributes | |
std::string | m_filename |
Lib3MF::PModel | model |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::DataHandling::MeshFileIO | |
MeshFileIO (ScaleUnits scaleType) | |
MeshFileIO (ScaleUnits scaleType, std::vector< uint32_t > triangles, std::vector< Kernel::V3D > vertices) | |
float | removeScale (double value) |
double | scaleValue (double val) |
void | setScaleType (const ScaleUnits scaleType) |
Protected Attributes inherited from Mantid::DataHandling::MeshFileIO | |
ScaleUnits | m_scaleType |
std::vector< uint32_t > | m_triangle |
std::vector< Kernel::V3D > | m_vertices |
Class to load and save .3mf files .3mf format is a 3D manufacturing format for storing mesh descriptions of multi-component objects + metadata about the overall model (eg scale) and the individual components.
The class currently uses the Lib3MF library to parse the files
Definition at line 35 of file Mantid3MFFileIO.h.
|
inline |
Definition at line 37 of file Mantid3MFFileIO.h.
References Mantid::DataHandling::undefined.
|
private |
Definition at line 360 of file Mantid3MFFileIO.cpp.
References model.
Referenced by setMaterialOnObject(), and writeMeshObject().
|
private |
Definition at line 308 of file Mantid3MFFileIO.cpp.
Referenced by writeMeshObject().
void Mantid::DataHandling::Mantid3MFFileIO::LoadFile | ( | std::string | filename | ) |
Load 3MF format file.
filename | The name of the 3MF file |
Definition at line 34 of file Mantid3MFFileIO.cpp.
References Mantid::DataHandling::centimetres, Mantid::API::g_log, m_filename, Mantid::DataHandling::metres, Mantid::DataHandling::millimetres, model, Mantid::DataHandling::MeshFileIO::setScaleType(), and Mantid::Kernel::Logger::warning().
Referenced by Mantid::DataHandling::LoadSampleEnvironment::loadEnvironmentFrom3MF(), and Mantid::DataHandling::SampleEnvironmentSpecParser::loadFullSpecification().
|
private |
Load a single mesh object into a Mantid Geometry::MeshObject.
meshObject | A Lib3mf pointer to the mesh object |
buildTransform | The rotation/translation to be applied to the object |
Definition at line 80 of file Mantid3MFFileIO.cpp.
References Mantid::DataHandling::MeshFileIO::createScaledV3D(), Mantid::Kernel::Logger::debug(), Mantid::API::g_log, m_filename, Mantid::DataHandling::MeshFileIO::m_triangle, Mantid::DataHandling::MeshFileIO::m_vertices, model, Mantid::Kernel::MaterialXMLParser::parse(), Mantid::DataHandling::MeshFileIO::scaleValue(), Mantid::Kernel::Matrix< T >::setRow(), std::to_string(), and Mantid::Kernel::Logger::warning().
Referenced by readMeshObject().
|
private |
Definition at line 225 of file Mantid3MFFileIO.cpp.
References model, and readMeshObject().
Referenced by readMeshObject().
|
private |
Attempt to read a single mesh from a specified lib3mf resource id.
If the resource id points at a component instead then read them
meshObjects | A vector to store the meshes for env components |
sample | A parameter to store a mesh for the sample |
objectResourceID | Integer identifier of the object to read in |
transform | Rotation/translation matrix for the object |
Definition at line 202 of file Mantid3MFFileIO.cpp.
References loadMeshObject(), model, and readComponents().
Referenced by readComponents(), and readMeshObjects().
void Mantid::DataHandling::Mantid3MFFileIO::readMeshObjects | ( | std::vector< MeshObject_sptr > & | meshObjects, |
MeshObject_sptr & | sample | ||
) |
Read a set of mesh objects from the in memory lib3mf model object.
meshObjects | A vector to store the meshes for env components |
sample | A parameter to store a mesh for the sample |
Definition at line 184 of file Mantid3MFFileIO.cpp.
References model, and readMeshObject().
Referenced by Mantid::DataHandling::LoadSampleEnvironment::loadEnvironmentFrom3MF(), and Mantid::DataHandling::SampleEnvironmentSpecParser::loadFullSpecification().
void Mantid::DataHandling::Mantid3MFFileIO::saveFile | ( | std::string | filename | ) |
Definition at line 458 of file Mantid3MFFileIO.cpp.
References model.
Referenced by Mantid::DataHandling::SaveSampleEnvironmentAndShape::exec().
|
private |
Definition at line 408 of file Mantid3MFFileIO.cpp.
References AddBaseMaterial(), Mantid::Kernel::Logger::debug(), Mantid::API::g_log, and model.
|
private |
Definition at line 240 of file Mantid3MFFileIO.cpp.
References AddBaseMaterial(), Mantid::Kernel::V3D::cross_prod(), Mantid::Kernel::Logger::debug(), Mantid::Geometry::Track::front(), Mantid::API::g_log, generateRandomColor(), Mantid::Geometry::MeshObject::getTriangles(), Mantid::Geometry::MeshObject::getV3Ds(), Mantid::Geometry::MeshObject::id(), Mantid::Geometry::MeshObject::interceptSurface(), Mantid::Geometry::MeshObject::material(), model, Mantid::Kernel::Material::name(), Mantid::Kernel::normalize(), and Mantid::Geometry::MeshObject::numberOfTriangles().
Referenced by writeMeshObjects().
void Mantid::DataHandling::Mantid3MFFileIO::writeMeshObjects | ( | std::vector< const Geometry::MeshObject * > | meshObjects, |
MeshObject_const_sptr & | sample, | ||
DataHandling::ScaleUnits | scale | ||
) |
Definition at line 325 of file Mantid3MFFileIO.cpp.
References Mantid::DataHandling::centimetres, Mantid::DataHandling::metres, Mantid::DataHandling::millimetres, model, and writeMeshObject().
Referenced by Mantid::DataHandling::SaveSampleEnvironmentAndShape::exec().
|
private |
Definition at line 49 of file Mantid3MFFileIO.h.
Referenced by LoadFile(), and loadMeshObject().
|
private |
Definition at line 48 of file Mantid3MFFileIO.h.
Referenced by AddBaseMaterial(), LoadFile(), loadMeshObject(), readComponents(), readMeshObject(), readMeshObjects(), saveFile(), setMaterialOnObject(), writeMeshObject(), and writeMeshObjects().