Mantid
Loading...
Searching...
No Matches
Mantid3MFFileIO.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "Bindings/Cpp/lib3mf_implicit.hpp"
11#include <memory>
12
13namespace Mantid {
14
15namespace Geometry {
16class MeshObject;
17}
18namespace DataHandling {
19
21using MeshObject_sptr = std::shared_ptr<Geometry::MeshObject>;
23using MeshObject_const_sptr = std::shared_ptr<const Geometry::MeshObject>;
24
35class MANTID_DATAHANDLING_DLL Mantid3MFFileIO : public MeshFileIO {
36public:
38 Lib3MF::PWrapper wrapper = Lib3MF::CWrapper::loadLibrary();
39 model = wrapper->CreateModel();
40 };
41 void LoadFile(std::string filename);
42 void readMeshObjects(std::vector<MeshObject_sptr> &meshObjects, MeshObject_sptr &sample);
43 void writeMeshObjects(std::vector<const Geometry::MeshObject *> meshObjects, MeshObject_const_sptr &sample,
45 void saveFile(std::string filename);
46
47private:
48 Lib3MF::PModel model;
49 std::string m_filename;
50 MeshObject_sptr loadMeshObject(Lib3MF::PMeshObject meshObject, sLib3MFTransform buildTransform);
51 void readMeshObject(std::vector<MeshObject_sptr> &meshObjects, MeshObject_sptr &sample, uint32_t objectResourceID,
52 sLib3MFTransform transform);
53 void readComponents(std::vector<MeshObject_sptr> &meshObjects, MeshObject_sptr &sample, uint32_t objectResourceID,
54 sLib3MFTransform transform);
55 void writeMeshObject(const Geometry::MeshObject &meshObject, std::string name);
56 void AddBaseMaterial(std::string materialName, int materialColor, int &resourceID, Lib3MF_uint32 &materialPropertyID);
57 void setMaterialOnObject(std::string objectName, std::string materialName, int materialColor);
58 int generateRandomColor();
59};
60} // namespace DataHandling
61} // namespace Mantid
Class to load and save .3mf files .3mf format is a 3D manufacturing format for storing mesh descripti...
Triangular Mesh Object.
Definition: MeshObject.h:50
std::shared_ptr< Geometry::MeshObject > MeshObject_sptr
Typdef for a shared pointer.
std::shared_ptr< const Geometry::MeshObject > MeshObject_const_sptr
Typdef for a shared pointer to a const object.
Helper class which provides the Collimation Length for SANS instruments.