Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::DataHandling::Mantid3MFFileIO Class Reference

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>

Inheritance diagram for Mantid::DataHandling::Mantid3MFFileIO:
Mantid::DataHandling::MeshFileIO

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::MeshObjectrotate (std::shared_ptr< Geometry::MeshObject > environmentMesh, double xRotation, double yRotation, double zRotation)
 Rotates the environment by a generated matrix. More...
 
std::shared_ptr< Geometry::MeshObjecttranslate (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::V3Dm_vertices
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Mantid3MFFileIO()

Mantid::DataHandling::Mantid3MFFileIO::Mantid3MFFileIO ( )
inline

Definition at line 37 of file Mantid3MFFileIO.h.

References Mantid::DataHandling::undefined.

Member Function Documentation

◆ AddBaseMaterial()

void Mantid::DataHandling::Mantid3MFFileIO::AddBaseMaterial ( std::string  materialName,
int  materialColor,
int &  resourceID,
Lib3MF_uint32 &  materialPropertyID 
)
private

Definition at line 360 of file Mantid3MFFileIO.cpp.

References model.

Referenced by setMaterialOnObject(), and writeMeshObject().

◆ generateRandomColor()

int Mantid::DataHandling::Mantid3MFFileIO::generateRandomColor ( )
private

Definition at line 308 of file Mantid3MFFileIO.cpp.

Referenced by writeMeshObject().

◆ LoadFile()

void Mantid::DataHandling::Mantid3MFFileIO::LoadFile ( std::string  filename)

◆ loadMeshObject()

MeshObject_sptr Mantid::DataHandling::Mantid3MFFileIO::loadMeshObject ( Lib3MF::PMeshObject  meshObject,
sLib3MFTransform  buildTransform 
)
private

◆ readComponents()

void Mantid::DataHandling::Mantid3MFFileIO::readComponents ( std::vector< MeshObject_sptr > &  meshObjects,
MeshObject_sptr sample,
uint32_t  objectResourceID,
sLib3MFTransform  transform 
)
private

Definition at line 225 of file Mantid3MFFileIO.cpp.

References model, and readMeshObject().

Referenced by readMeshObject().

◆ readMeshObject()

void Mantid::DataHandling::Mantid3MFFileIO::readMeshObject ( std::vector< MeshObject_sptr > &  meshObjects,
MeshObject_sptr sample,
uint32_t  objectResourceID,
sLib3MFTransform  transform 
)
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

Parameters
meshObjectsA vector to store the meshes for env components
sampleA parameter to store a mesh for the sample
objectResourceIDInteger identifier of the object to read in
transformRotation/translation matrix for the object

Definition at line 202 of file Mantid3MFFileIO.cpp.

References loadMeshObject(), model, and readComponents().

Referenced by readComponents(), and readMeshObjects().

◆ 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.

Parameters
meshObjectsA vector to store the meshes for env components
sampleA 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().

◆ saveFile()

void Mantid::DataHandling::Mantid3MFFileIO::saveFile ( std::string  filename)

Definition at line 458 of file Mantid3MFFileIO.cpp.

References model.

Referenced by Mantid::DataHandling::SaveSampleEnvironmentAndShape::exec().

◆ setMaterialOnObject()

void Mantid::DataHandling::Mantid3MFFileIO::setMaterialOnObject ( std::string  objectName,
std::string  materialName,
int  materialColor 
)
private

◆ writeMeshObject()

void Mantid::DataHandling::Mantid3MFFileIO::writeMeshObject ( const Geometry::MeshObject meshObject,
std::string  name 
)
private

◆ writeMeshObjects()

void Mantid::DataHandling::Mantid3MFFileIO::writeMeshObjects ( std::vector< const Geometry::MeshObject * >  meshObjects,
MeshObject_const_sptr sample,
DataHandling::ScaleUnits  scale 
)

Member Data Documentation

◆ m_filename

std::string Mantid::DataHandling::Mantid3MFFileIO::m_filename
private

Definition at line 49 of file Mantid3MFFileIO.h.

Referenced by LoadFile(), and loadMeshObject().

◆ model

Lib3MF::PModel Mantid::DataHandling::Mantid3MFFileIO::model
private

The documentation for this class was generated from the following files: