From 63c33c90e6bf4aa95b2d8bb1a647b498bacd4d49 Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 13 Oct 2023 18:05:52 +0800 Subject: [PATCH] ENH: do not clone object to plate boundary Jira: none Change-Id: I72f33d7633bd6ccd43cabbfd0262818b1655c21b (cherry picked from commit 99ea969b30a25ddd063da5fb0e246ce01d4b6764) --- src/slic3r/GUI/GLCanvas3D.cpp | 4 ++-- src/slic3r/GUI/Selection.cpp | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 070900211..24708a528 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4909,8 +4909,8 @@ std::vector GLCanvas3D::get_empty_cells(const Vec2f start_point, const Ve Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y()); BoundingBoxf bbox(vmin, vmax); std::vector cells; - for (float x = bbox.min.x(); x < bbox.max.x(); x += step(0)) - for (float y = bbox.min.y(); y < bbox.max.y(); y += step(1)) + for (float x = bbox.min.x()+step(0)/2; x < bbox.max.x()-step(0)/2; x += step(0)) + for (float y = bbox.min.y()+step(1)/2; y < bbox.max.y()-step(1)/2; y += step(1)) { cells.emplace_back(x, y); } diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 5c8b62deb..54ae6b4a4 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -458,10 +458,12 @@ void Selection::remove_curr_plate() void Selection::clone(int numbers) { - if (numbers > 0) - wxGetApp().plater()->take_snapshot(std::string("Selection-clone")); + if (numbers <= 0) + return; + + wxGetApp().plater()->take_snapshot(std::string("Selection-clone")); + copy_to_clipboard(); for (int i = 0; i < numbers; i++) { - copy_to_clipboard(); paste_from_clipboard(); } } @@ -2722,7 +2724,7 @@ void Selection::paste_objects_from_clipboard() { const ModelObject *src_object = src_objects[i]; ModelObject* dst_object = m_model->add_object(*src_object); - + // BBS: find an empty cell to put the copied object BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(0);