From ff1ac5fdad82b1ae1ccb6b479a87c9355aba7111 Mon Sep 17 00:00:00 2001 From: Ian Rees Date: Sat, 4 Feb 2017 12:05:51 +1300 Subject: [PATCH] Add AMF to understood extensions/formats. --- src/Mod/Mesh/App/AppMeshPy.cpp | 10 ++++++++++ src/Mod/Mesh/App/Core/MeshIO.cpp | 3 +++ src/Mod/Mesh/App/Core/MeshIO.h | 3 ++- src/Mod/Mesh/Init.py | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Mod/Mesh/App/AppMeshPy.cpp b/src/Mod/Mesh/App/AppMeshPy.cpp index 47c62c411..f20ac5a13 100644 --- a/src/Mod/Mesh/App/AppMeshPy.cpp +++ b/src/Mod/Mesh/App/AppMeshPy.cpp @@ -299,6 +299,16 @@ private: MeshObject global_mesh; + auto exportFormat( MeshOutput::GetFormat(EncodedName.c_str()) ); + + // Currently, AMF is the only export format where we export separate meshes + // into the same file. + auto combineMeshes( exportFormat != MeshIO::AMF ); + if (!combineMeshes) { + Base::Console().Message("AMF Export isn't quite supported yet."); + return Py::None(); + } + Py::Sequence list(object); Base::Type meshId = Base::Type::fromName("Mesh::Feature"); Base::Type partId = Base::Type::fromName("Part::Feature"); diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index fe41d815c..7f53ef2fb 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -1628,6 +1628,9 @@ MeshIO::Format MeshOutput::GetFormat(const char* FileName) else if (file.hasExtension("nas") || file.hasExtension("bdf")) { return MeshIO::NAS; } + else if (file.hasExtension("amf")) { + return MeshIO::AMF; + } else { return MeshIO::Undefined; } diff --git a/src/Mod/Mesh/App/Core/MeshIO.h b/src/Mod/Mesh/App/Core/MeshIO.h index 953d9a5fd..8f0d9c1ac 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.h +++ b/src/Mod/Mesh/App/Core/MeshIO.h @@ -53,7 +53,8 @@ namespace MeshIO { NAS, PLY, APLY, - PY + PY, + AMF }; enum Binding { OVERALL, diff --git a/src/Mod/Mesh/Init.py b/src/Mod/Mesh/Init.py index a5e9fe24f..2b1476a9c 100644 --- a/src/Mod/Mesh/Init.py +++ b/src/Mod/Mesh/Init.py @@ -13,3 +13,4 @@ FreeCAD.addExportType("Binary Mesh (*.bms)","Mesh") FreeCAD.addExportType("Alias Mesh (*.obj)","Mesh") FreeCAD.addExportType("Object File Format Mesh (*.off)","Mesh") FreeCAD.addExportType("Stanford Triangle Mesh (*.ply)","Mesh") +FreeCAD.addExportType("Additive Manufacturing Format (*.amf)","Mesh")