diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 0f5cb20b8c..2e8a704005 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -1975,6 +1975,14 @@ const TriangleMesh& SLAPrintObject::pad_mesh() const return EMPTY_MESH; } +const TriangleMesh &SLAPrintObject::hollowed_interior_mesh() const +{ + if (m_hollowing_data && m_config.hollowing_enable.getBool()) + return m_hollowing_data->interior; + + return EMPTY_MESH; +} + const TriangleMesh &SLAPrintObject::transformed_mesh() const { // we need to transform the raw mesh... // currently all the instances share the same x and y rotation and scaling diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 268b4dc30b..52d1df3179 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5362,6 +5362,8 @@ void GLCanvas3D::_load_sla_shells() unsigned int initial_volumes_count = (unsigned int)m_volumes.volumes.size(); for (const SLAPrintObject::Instance& instance : obj->instances()) { add_volume(*obj, 0, instance, obj->transformed_mesh(), GLVolume::MODEL_COLOR[0], true); + if (! obj->hollowed_interior_mesh().empty()) + add_volume(*obj, -int(slaposHollowing), instance, obj->hollowed_interior_mesh(), GLVolume::MODEL_COLOR[0], false); // Set the extruder_id and volume_id to achieve the same color as in the 3D scene when // through the update_volumes_colors_by_extruder() call. m_volumes.volumes.back()->extruder_id = obj->model_object()->volumes.front()->extruder_id(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index 34173366d2..2c3620dd7b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -595,17 +595,9 @@ void GLGizmoHollow::on_update(const UpdateData& data) } -void GLGizmoHollow::hollow_mesh(float offset, float adaptibility) +void GLGizmoHollow::hollow_mesh(float offset) { -// Slic3r::sla::Contour3D imesh{*m_mesh}; -// auto ptr = meshToVolume(imesh, {}); -// sla::Contour3D omesh = volumeToMesh(*ptr, -offset, adaptibility, true); - -// if (omesh.empty()) -// return; - -// imesh.merge(omesh); - TriangleMesh cavity = hollowed_interior(*m_mesh, double(offset), int(adaptibility)); + TriangleMesh cavity = hollowed_interior(*m_mesh, double(offset)); if (cavity.empty()) return; @@ -700,7 +692,7 @@ RENDER_AGAIN: if (m_editing_mode) { if (m_imgui->button(m_desc.at("hollow"))) { - hollow_mesh(m_offset, m_adaptibility); + hollow_mesh(m_offset); } float diameter_upper_cap = static_cast(wxGetApp().preset_bundle->sla_prints.get_edited_preset().config.option("support_pillar_diameter"))->value; @@ -762,9 +754,6 @@ RENDER_AGAIN: m_imgui->text("Offset: "); ImGui::SameLine(); ImGui::SliderFloat(" ", &m_offset, 0.f, 10.f, "%.1f"); - m_imgui->text("Adaptibility: "); - ImGui::SameLine(); - ImGui::SliderFloat(" ", &m_adaptibility, 0.f, 1.f, "%.1f"); } else { // not in editing mode: m_imgui->text(m_desc.at("minimal_distance")); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp index 82455a9f40..ba950594a2 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp @@ -92,7 +92,7 @@ private: void render_clipping_plane(const Selection& selection) const; bool is_mesh_update_necessary() const; void update_mesh(); - void hollow_mesh(float offset = 2.f, float adaptability = 1.f); + void hollow_mesh(float offset = 2.f); bool unsaved_changes() const; const TriangleMesh* mesh() const; @@ -109,7 +109,6 @@ private: std::vector m_normal_cache; // to restore after discarding changes or undo/redo float m_offset = 2.f; - float m_adaptibility = 1.f; float m_clipping_plane_distance = 0.f; std::unique_ptr m_clipping_plane; diff --git a/tests/libslic3r/test_hollowing.cpp b/tests/libslic3r/test_hollowing.cpp index b463fd863e..9a2ea2e726 100644 --- a/tests/libslic3r/test_hollowing.cpp +++ b/tests/libslic3r/test_hollowing.cpp @@ -49,7 +49,7 @@ static Slic3r::TriangleMesh load_model(const std::string &obj_filename) TEST_CASE("Negative 3D offset should produce smaller object.", "[Hollowing]") { - Slic3r::TriangleMesh in_mesh = load_model("zaba.obj"); + Slic3r::TriangleMesh in_mesh = load_model("20mm_cube.obj"); Benchmark bench; bench.start();