From 3225124a7cb397fef6cfab40185ab0f3610d171c Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 22 Jan 2024 11:06:20 +0800 Subject: [PATCH] ENH:The first object should locate at plate center Jira: STUDIO-6023 Change-Id: If4284136fe63ca576463445f3ab16b6e18ead30f --- src/slic3r/GUI/GLCanvas3D.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 32502a483..b005fe06b 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4960,8 +4960,10 @@ 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()+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)) + auto min_x = start_point.x() - step(0) * int((start_point.x() - bbox.min.x()) / step(0)); + auto min_y = start_point.y() - step(1) * int((start_point.y() - bbox.min.y()) / step(1)); + for (float x = min_x; x < bbox.max.x() - step(0) / 2; x += step(0)) + for (float y = min_y; y < bbox.max.y() - step(1) / 2; y += step(1)) { cells.emplace_back(x, y); }