From f5c7034f4753a2b79c281f5fb67319c9bbd3f4bc Mon Sep 17 00:00:00 2001
From: enricoturri1966 <enricoturri@seznam.cz>
Date: Tue, 23 Jun 2020 13:38:25 +0200
Subject: [PATCH 1/2] Fixed 'Export plate as STL including supports' command

---
 src/slic3r/GUI/Plater.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 8c3a90370..f71ee4a04 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -4847,25 +4847,33 @@ void Plater::export_stl(bool extended, bool selection_only)
                             ? Transform3d::Identity()
                             : object->model_object()->instances[instance_idx]->get_transformation().get_matrix();
 
+                    TriangleMesh inst_mesh;
+
                     if (has_pad_mesh)
                     {
                         TriangleMesh inst_pad_mesh = pad_mesh;
                         inst_pad_mesh.transform(inst_transform, is_left_handed);
-                        mesh.merge(inst_pad_mesh);
+                        inst_mesh.merge(inst_pad_mesh);
                     }
 
                     if (has_supports_mesh)
                     {
                         TriangleMesh inst_supports_mesh = supports_mesh;
                         inst_supports_mesh.transform(inst_transform, is_left_handed);
-                        mesh.merge(inst_supports_mesh);
+                        inst_mesh.merge(inst_supports_mesh);
                     }
 
                     TriangleMesh inst_object_mesh = object->get_mesh_to_print();
                     inst_object_mesh.transform(mesh_trafo_inv);
                     inst_object_mesh.transform(inst_transform, is_left_handed);
 
-                    mesh.merge(inst_object_mesh);
+                    inst_mesh.merge(inst_object_mesh);
+
+                    // ensure that the instance lays on the bed
+                    inst_mesh.translate(0.0f, 0.0f, -inst_mesh.bounding_box().min[2]);
+
+                    // merge instance with global mesh
+                    mesh.merge(inst_mesh);
 
                     if (one_inst_only)
                         break;

From 990bfc0d760dbf396a2a1b8b50b35aae78f07f5f Mon Sep 17 00:00:00 2001
From: YuSanka <yusanka@gmail.com>
Date: Wed, 24 Jun 2020 11:29:09 +0200
Subject: [PATCH 2/2] Fix of #4428   Don't update a visibility of the
 collapse_toolbar: if sidebar is collapsed and "show_collapse_button" doesn't
 have "true" value

 + Fixed typos in the Preferences.cpp
---
 src/slic3r/GUI/Plater.cpp      | 3 ---
 src/slic3r/GUI/Preferences.cpp | 8 ++++----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index f71ee4a04..ac6e7819b 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -2087,9 +2087,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
     // collapse sidebar according to saved value
     bool is_collapsed = wxGetApp().app_config->get("collapsed_sidebar") == "1";
     sidebar->collapse(is_collapsed);
-    // Update an enable of the collapse_toolbar: if sidebar is collapsed, then collapse_toolbar should be visible
-    if (is_collapsed)
-        wxGetApp().app_config->set("show_collapse_button", "1");
 }
 
 Plater::priv::~priv()
diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp
index 84ad54879..02e4a899d 100644
--- a/src/slic3r/GUI/Preferences.cpp
+++ b/src/slic3r/GUI/Preferences.cpp
@@ -161,7 +161,7 @@ void PreferencesDialog::build()
 		}
 	};
 
-	def.label = L("Show the button for the collapse sidebar");
+	def.label = L("Show sidebar collapse/expand button");
 	def.type = coBool;
 	def.tooltip = L("If enabled, the button for the collapse sidebar will be appeared in top right corner of the 3D Scene");
 	def.set_default_value(new ConfigOptionBool{ app_config->get("show_collapse_button") == "1" });
@@ -353,9 +353,9 @@ void PreferencesDialog::create_icon_size_slider()
 
 void PreferencesDialog::create_settings_mode_widget()
 {
-	wxString choices[] = {	_L("Old regular layout with tab bar"),
-							_L("New layout without the tab bar on the platter"),
-							_L("Settings will be shown in non-modal dialog")		};
+	wxString choices[] = {	_L("Old regular layout with the tab bar"),
+							_L("New layout without the tab bar on the plater"),
+							_L("Settings will be shown in the non-modal dialog")		};
 
 	auto app_config = get_app_config();
 	int selection = app_config->get("old_settings_layout_mode") == "1" ? 0 :