From 793a642bd7ab6ab25cdbaece55342b3e72341b22 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 7 Sep 2023 14:44:43 +0800 Subject: [PATCH] ENH: improve auto-arranging of A1 mini 1. the best object pos of A1 mini is [0.7,0.5] of bed. 2. dominant direction is more accurate (solve the problem that cubes are not arranged neatly). Jira: STUDIO-4356 Change-Id: I8931f51a97bee96d5d9e75306481eae2e0cdc059 --- .../BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json | 1 + src/libslic3r/Arrange.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json index e7e5cc1ec4..abab5660a1 100644 --- a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json @@ -12,6 +12,7 @@ "printer_variant": "0.4", "auxiliary_fan": "0", "bed_exclude_area": [], + "best_object_pos": "0.7x0.5", "default_filament_profile": [ "Bambu PLA Basic @BBL A1M" ], diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 838850a59d..83544a5d37 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -217,8 +217,14 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr double b = m11 / m00 - cx * cy; double c = m02 / m00 - cy * cy; - angle = std::atan2(2 * b, (a - c)) / 2; - validResult = true; + //if a and c are close, there is no dominant axis, then do not rotate + if (std::abs(a) < 1.5*std::abs(c) && std::abs(c) < 1.5*std::abs(a)) { + validResult = false; + } + else { + angle = std::atan2(2 * b, (a - c)) / 2; + validResult = true; + } } } if (validResult) { ap.rotation += (PI / 2 - angle); }