From 3fce7da269be0115da4f07e28de6add71cb55e21 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 14 Dec 2019 15:33:33 +0100 Subject: [PATCH] Mesh: [skip ci] Add static method to get list of supported input/output mesh formats --- src/Mod/Mesh/App/Core/MeshIO.cpp | 28 ++++++++++++++++++++++++++++ src/Mod/Mesh/App/Core/MeshIO.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index c8e18de805..8b6010d4cc 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -139,6 +139,18 @@ struct Color_Less : public std::binary_function MeshInput::supportedMeshFormats() +{ + std::vector fmt; + fmt.emplace_back("bms"); + fmt.emplace_back("ply"); + fmt.emplace_back("stl"); + fmt.emplace_back("obj"); + fmt.emplace_back("off"); + fmt.emplace_back("smf"); + return fmt; +} + bool MeshInput::LoadAny(const char* FileName) { // ask for read permission @@ -1747,6 +1759,22 @@ void MeshOutput::Transform(const Base::Matrix4D& mat) apply_transform = true; } +std::vector MeshOutput::supportedMeshFormats() +{ + std::vector fmt; + fmt.emplace_back("bms"); + fmt.emplace_back("ply"); + fmt.emplace_back("stl"); + fmt.emplace_back("obj"); + fmt.emplace_back("off"); + fmt.emplace_back("smf"); + fmt.emplace_back("x3d"); + fmt.emplace_back("wrl"); + fmt.emplace_back("wrz"); + fmt.emplace_back("amf"); + return fmt; +} + MeshIO::Format MeshOutput::GetFormat(const char* FileName) { Base::FileInfo file(FileName); diff --git a/src/Mod/Mesh/App/Core/MeshIO.h b/src/Mod/Mesh/App/Core/MeshIO.h index c99d1ce966..c2543f9ef8 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.h +++ b/src/Mod/Mesh/App/Core/MeshIO.h @@ -129,6 +129,8 @@ public: /** Loads a Cadmould FE file. */ bool LoadCadmouldFE (std::ifstream &rstrIn); + static std::vector supportedMeshFormats(); + protected: MeshKernel &_rclMesh; /**< reference to mesh data structure */ Material* _material; @@ -205,6 +207,8 @@ public: /** Writes a python module which creates a mesh */ bool SavePython (std::ostream &rstrOut) const; + static std::vector supportedMeshFormats(); + protected: const MeshKernel &_rclMesh; /**< reference to mesh data structure */ const Material* _material;