ENH: do not clone object to plate boundary

Jira: none
Change-Id: I72f33d7633bd6ccd43cabbfd0262818b1655c21b
(cherry picked from commit 99ea969b30a25ddd063da5fb0e246ce01d4b6764)
This commit is contained in:
Arthur 2023-10-13 18:05:52 +08:00 committed by Lane.Wei
parent af1af05a98
commit 63c33c90e6
2 changed files with 8 additions and 6 deletions

View File

@ -4909,8 +4909,8 @@ std::vector<Vec2f> 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()); Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y());
BoundingBoxf bbox(vmin, vmax); BoundingBoxf bbox(vmin, vmax);
std::vector<Vec2f> cells; std::vector<Vec2f> cells;
for (float x = bbox.min.x(); x < bbox.max.x(); x += step(0)) 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(); y < bbox.max.y(); y += step(1)) for (float y = bbox.min.y()+step(1)/2; y < bbox.max.y()-step(1)/2; y += step(1))
{ {
cells.emplace_back(x, y); cells.emplace_back(x, y);
} }

View File

@ -458,10 +458,12 @@ void Selection::remove_curr_plate()
void Selection::clone(int numbers) void Selection::clone(int numbers)
{ {
if (numbers > 0) if (numbers <= 0)
wxGetApp().plater()->take_snapshot(std::string("Selection-clone")); return;
wxGetApp().plater()->take_snapshot(std::string("Selection-clone"));
copy_to_clipboard();
for (int i = 0; i < numbers; i++) { for (int i = 0; i < numbers; i++) {
copy_to_clipboard();
paste_from_clipboard(); paste_from_clipboard();
} }
} }
@ -2722,7 +2724,7 @@ void Selection::paste_objects_from_clipboard()
{ {
const ModelObject *src_object = src_objects[i]; const ModelObject *src_object = src_objects[i];
ModelObject* dst_object = m_model->add_object(*src_object); ModelObject* dst_object = m_model->add_object(*src_object);
// BBS: find an empty cell to put the copied object // BBS: find an empty cell to put the copied object
BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(0); BoundingBoxf3 bbox = src_object->instance_convex_hull_bounding_box(0);