From 025fdc1359a7f4e72cdf186bae58f380d092ab51 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Wed, 26 Sep 2018 11:24:19 +0200 Subject: [PATCH] Fixed #1244 - c++ part --- xs/src/libslic3r/Model.cpp | 5 +++++ xs/src/libslic3r/Model.hpp | 1 + xs/src/slic3r/GUI/GUI_ObjectParts.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index bd96aa3b9..23c1853b8 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -988,6 +988,11 @@ const TriangleMesh& ModelVolume::get_convex_hull() const return m_convex_hull; } +TriangleMesh& ModelVolume::get_convex_hull() +{ + return m_convex_hull; +} + ModelVolume::Type ModelVolume::type_from_string(const std::string &s) { // Legacy support diff --git a/xs/src/libslic3r/Model.hpp b/xs/src/libslic3r/Model.hpp index 7a186df5d..d3752eded 100644 --- a/xs/src/libslic3r/Model.hpp +++ b/xs/src/libslic3r/Model.hpp @@ -196,6 +196,7 @@ public: void calculate_convex_hull(); const TriangleMesh& get_convex_hull() const; + TriangleMesh& get_convex_hull(); // Helpers for loading / storing into AMF / 3MF files. static Type type_from_string(const std::string &s); diff --git a/xs/src/slic3r/GUI/GUI_ObjectParts.cpp b/xs/src/slic3r/GUI/GUI_ObjectParts.cpp index 949c77171..0c7eb6285 100644 --- a/xs/src/slic3r/GUI/GUI_ObjectParts.cpp +++ b/xs/src/slic3r/GUI/GUI_ObjectParts.cpp @@ -1235,7 +1235,10 @@ void load_part( ModelObject* model_object, part_names.Add(new_volume->name); if (delta != Vec3d::Zero()) + { new_volume->mesh.translate((float)delta(0), (float)delta(1), (float)delta(2)); + new_volume->get_convex_hull().translate((float)delta(0), (float)delta(1), (float)delta(2)); + } // set a default extruder value, since user can't add it manually new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));