From abbd4e3ca7ce7a2e9df4bd84a5628ac01003b832 Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 17 Jan 2024 11:21:26 +0800 Subject: [PATCH] ENH: export stl with proper translation 1. export stl with proper translation If the object is not on first plate, previous export will give the vertices very big coordinates. jira: STUDIO-5991 2. add log for boolean failure reasons. Change-Id: I52cec4e3ca31b215fbe60246f0266de3d4b8cb61 (cherry picked from commit 6c4dbc8c6c43dd5789e5ce3a572f465548068b77) --- src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp | 12 +++++++++--- src/slic3r/GUI/GUI_Factories.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp b/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp index e98903378..7d0c13e71 100644 --- a/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp +++ b/src/libslic3r/CSGMesh/PerformCSGMeshBooleans.hpp @@ -275,14 +275,20 @@ It check_csgmesh_booleans(const Range &csgrange, Visitor &&vfn) } try { - if (!m || MeshBoolean::cgal::empty(*m)) + if (!m || MeshBoolean::cgal::empty(*m)) { + BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh " << i << "/" << csgrange.size() << " is empty, cannot do boolean!"; return; + } - if (!MeshBoolean::cgal::does_bound_a_volume(*m)) + if (!MeshBoolean::cgal::does_bound_a_volume(*m)) { + BOOST_LOG_TRIVIAL(info) << "check_csgmesh_booleans fails! mesh "<export_stl(false, true); }, "", nullptr, [is_mulity_menu]() { const Selection& selection = plater()->canvas3D()->get_selection(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 64d1a3357..251299f0c 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -11090,7 +11090,10 @@ void Plater::export_stl(bool extended, bool selection_only, bool multi_stls) mesh.transform(volume->get_volume_transformation().get_matrix(), true); } - if (model_object->instances.size() == 1) mesh.translate(-model_object->origin_translation.cast()); + if (model_object->instances.size() == 1) { + //coconut: make the mesh's origin=(0,0,0). origin_translation is useless here. + mesh.align_to_origin();//translate(- model_object->origin_translation.cast()); + } } else if (selection.is_multiple_full_object() && !multi_stls) { const std::set>& instances_idxs = p->get_selection().get_selected_object_instances();