From a394e55e0781986b22c09fafae50dd1f8ed1dcc1 Mon Sep 17 00:00:00 2001
From: Enrico Turri <enricoturri@seznam.cz>
Date: Tue, 18 Dec 2018 10:49:22 +0100
Subject: [PATCH] Added method ModelObject::full_raw_mesh()

---
 src/libslic3r/Model.cpp | 19 +++++++++++++++++++
 src/libslic3r/Model.hpp |  2 ++
 2 files changed, 21 insertions(+)

diff --git a/src/libslic3r/Model.cpp b/src/libslic3r/Model.cpp
index 07f1b98c1..7ebcbd815 100644
--- a/src/libslic3r/Model.cpp
+++ b/src/libslic3r/Model.cpp
@@ -809,6 +809,25 @@ TriangleMesh ModelObject::raw_mesh() const
     return mesh;
 }
 
+// Non-transformed (non-rotated, non-scaled, non-translated) sum of all object volumes.
+TriangleMesh ModelObject::full_raw_mesh() const
+{
+    TriangleMesh mesh;
+    for (const ModelVolume *v : this->volumes)
+#if ENABLE_MODELVOLUME_TRANSFORM
+    {
+        TriangleMesh vol_mesh(v->mesh);
+        vol_mesh.transform(v->get_matrix());
+        mesh.merge(vol_mesh);
+    }
+#else
+    {
+        mesh.merge(v->mesh);
+    }
+#endif // ENABLE_MODELVOLUME_TRANSFORM
+    return mesh;
+}
+
 // A transformed snug bounding box around the non-modifier object volumes, without the translation applied.
 // This bounding box is only used for the actual slicing.
 BoundingBoxf3 ModelObject::raw_bounding_box() const
diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp
index b02862203..b396bd1db 100644
--- a/src/libslic3r/Model.hpp
+++ b/src/libslic3r/Model.hpp
@@ -218,6 +218,8 @@ public:
     // Non-transformed (non-rotated, non-scaled, non-translated) sum of non-modifier object volumes.
     // Currently used by ModelObject::mesh() and to calculate the 2D envelope for 2D platter.
     TriangleMesh raw_mesh() const;
+    // Non-transformed (non-rotated, non-scaled, non-translated) sum of all object volumes.
+    TriangleMesh full_raw_mesh() const;
     // A transformed snug bounding box around the non-modifier object volumes, without the translation applied.
     // This bounding box is only used for the actual slicing.
     BoundingBoxf3 raw_bounding_box() const;