From 0efa2db823fa3b69cfde2d40b47b0724211f18d6 Mon Sep 17 00:00:00 2001 From: "qing.zhang" Date: Mon, 15 Apr 2024 16:52:47 +0800 Subject: [PATCH] ENH: imprve overhang quality Jira: none add speed transition between discontinuity speed detect bridge-wall and only use bride speed on bridge wall fix the bug that not use overhang speed while support z distance is 0 on arachne mode Signed-off-by: qing.zhang Change-Id: I72a1504544fe1ed7bd184ca073bd1b52cd2dcd75 --- ...06mm High Quality @BBL X1C 0.2 nozzle.json | 2 + .../0.06mm Standard @BBL X1C 0.2 nozzle.json | 2 + .../process/0.08mm Extra Fine @BBL X1C.json | 2 + ...08mm High Quality @BBL X1C 0.2 nozzle.json | 2 + .../process/0.08mm High Quality @BBL X1C.json | 2 + .../0.08mm Standard @BBL X1C 0.2 nozzle.json | 2 + ...10mm High Quality @BBL X1C 0.2 nozzle.json | 2 + .../0.10mm Standard @BBL X1C 0.2 nozzle.json | 2 + .../BBL/process/0.12mm Fine @BBL X1C.json | 2 + .../process/0.12mm High Quality @BBL X1C.json | 2 + .../0.12mm Standard @BBL X1C 0.2 nozzle.json | 2 + .../0.14mm Standard @BBL X1C 0.2 nozzle.json | 2 + .../process/0.16mm High Quality @BBL X1C.json | 2 + .../BBL/process/0.16mm Optimal @BBL X1C.json | 2 + .../0.18mm Standard @BBL X1C 0.6 nozzle.json | 2 + .../BBL/process/0.20mm Standard @BBL X1C.json | 2 + .../BBL/process/0.20mm Strength @BBL X1C.json | 2 + .../BBL/process/0.24mm Draft @BBL X1C.json | 2 + .../0.24mm Standard @BBL X1C 0.6 nozzle.json | 2 + .../0.24mm Standard @BBL X1C 0.8 nozzle.json | 2 + .../process/0.28mm Extra Draft @BBL X1C.json | 2 + .../0.30mm Standard @BBL X1C 0.6 nozzle.json | 2 + .../0.30mm Strength @BBL X1C 0.6 nozzle.json | 2 + .../0.32mm Standard @BBL X1C 0.8 nozzle.json | 2 + .../0.36mm Standard @BBL X1C 0.6 nozzle.json | 2 + .../0.40mm Standard @BBL X1C 0.8 nozzle.json | 2 + .../0.42mm Standard @BBL X1C 0.6 nozzle.json | 2 + .../0.48mm Standard @BBL X1C 0.8 nozzle.json | 2 + .../0.56mm Standard @BBL X1C 0.8 nozzle.json | 2 + .../BBL/process/fdm_process_common.json | 4 +- src/libslic3r/Arachne/utils/ExtrusionLine.cpp | 13 +- src/libslic3r/Arachne/utils/ExtrusionLine.hpp | 6 +- src/libslic3r/ExtrusionEntity.hpp | 7 + src/libslic3r/GCode.cpp | 317 +++++++++++++++++- src/libslic3r/GCode.hpp | 7 + src/libslic3r/PerimeterGenerator.cpp | 102 ++++-- src/libslic3r/Preset.cpp | 7 +- src/libslic3r/PrintConfig.cpp | 26 +- src/libslic3r/PrintConfig.hpp | 3 + src/libslic3r/PrintObject.cpp | 3 + src/libslic3r/VariableWidth.cpp | 6 +- src/libslic3r/VariableWidth.hpp | 2 +- src/slic3r/GUI/GUI_Factories.cpp | 4 +- src/slic3r/GUI/Tab.cpp | 3 + 44 files changed, 516 insertions(+), 52 deletions(-) diff --git a/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json index 70e54ac6c..56388c0b1 100644 --- a/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm High Quality @BBL X1C 0.2 nozzle.json @@ -11,6 +11,8 @@ "outer_wall_acceleration": "2000", "outer_wall_speed": "60", "sparse_infill_pattern": "gyroid", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json index 5ffde15e9..15ac55524 100644 --- a/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of 0.2 mm nozzle, it has a smaller layer height, and results in minimal layer lines and higher printing quality, but shorter printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json index ddb385860..22ed2d795 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json @@ -6,6 +6,8 @@ "setting_id": "GP001", "instantiation": "true", "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and longer printing time.", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json index 5b04803ce..dc0de89bc 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C 0.2 nozzle.json @@ -11,6 +11,8 @@ "outer_wall_acceleration": "2000", "outer_wall_speed": "60", "sparse_infill_pattern": "gyroid", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json index 1c7a15e91..778b1b9be 100644 --- a/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json +++ b/resources/profiles/BBL/process/0.08mm High Quality @BBL X1C.json @@ -15,6 +15,8 @@ "sparse_infill_pattern": "gyroid", "sparse_infill_speed": "150", "top_surface_speed": "150", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json index 4d1c9fa00..905fef5e0 100644 --- a/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.2 mm nozzle, it has a smaller layer height, and results in almost invisible layer lines and higher printing quality, but shorter printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json index 60f8e2686..b1ab2d897 100644 --- a/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm High Quality @BBL X1C 0.2 nozzle.json @@ -11,6 +11,8 @@ "outer_wall_acceleration": "2000", "outer_wall_speed": "60", "sparse_infill_pattern": "gyroid", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json index 241c0a358..64f47b93a 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "It has a small layer height, and results in almost negligible layer lines and high printing quality. It is suitable for most general printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json b/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json index d42c4dcd6..b51e89eb5 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json @@ -6,6 +6,8 @@ "setting_id": "GP002", "instantiation": "true", "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in almost negligible layer lines and higher printing quality, but longer printing time.", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json b/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json index f2e438994..d49e93148 100644 --- a/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json +++ b/resources/profiles/BBL/process/0.12mm High Quality @BBL X1C.json @@ -15,6 +15,8 @@ "sparse_infill_pattern": "gyroid", "sparse_infill_speed": "180", "top_surface_speed": "150", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json index e90901731..703993972 100644 --- a/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.2 mm nozzle, it has a slightly bigger layer height, and results in almost negligible layer lines, and slightly shorter printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json index b6d8ecc23..be951de13 100644 --- a/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.2 mm nozzle, it has a bigger layer height, and results in slightly visible layer lines, but shorter printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", diff --git a/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json b/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json index e5f73eab5..2e8fb3e44 100644 --- a/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json +++ b/resources/profiles/BBL/process/0.16mm High Quality @BBL X1C.json @@ -15,6 +15,8 @@ "sparse_infill_pattern": "gyroid", "sparse_infill_speed": "200", "top_surface_speed": "150", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json index 0d12d4ddb..5dc996d12 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json @@ -6,6 +6,8 @@ "setting_id": "GP003", "instantiation": "true", "description": "Compared with the default profile of a 0.4 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json index 15ebedb2a..6395e965b 100644 --- a/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and higher printing quality, but longer printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json index 2f38b67fa..01133f83e 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json @@ -6,6 +6,8 @@ "setting_id": "GP004", "instantiation": "true", "description": "It has a general layer height, and results in general layer lines and printing quality. It is suitable for most general printing cases.", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json index a62137630..6635305de 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json @@ -8,6 +8,8 @@ "description": "Compared with the default profile of a 0.4 mm nozzle, it has more wall loops and a higher sparse infill density. So, it results in higher strength of the prints, but more filament consumption and longer printing time.", "outer_wall_speed": "60", "sparse_infill_density": "25%", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "wall_loops": "6", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json b/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json index 01505bf22..cc2806ac9 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json @@ -6,6 +6,8 @@ "setting_id": "GP005", "instantiation": "true", "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but slightly shorter printing time.", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json index 992bb0f1c..2675aaa37 100644 --- a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.6 mm nozzle, it has a smaller layer height, and results in less apparent layer lines and slight higher printing quality, but longer printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json index 9be5eed98..9ff95902a 100644 --- a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.8 mm nozzle, it has a smaller layer height, and results in less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json index 8c2e794da..4d544e0f9 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json @@ -6,6 +6,8 @@ "setting_id": "GP006", "instantiation": "true", "description": "Compared with the default profile of a 0.4 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time.", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json index 3f0a4dacb..7a6291025 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "It has a big layer height, and results in apparent layer lines and ordinary printing quality and printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json index affc54538..7d39dcfa0 100644 --- a/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json @@ -9,6 +9,8 @@ "elefant_foot_compensation": "0.15", "sparse_infill_density": "25%", "wall_loops": "4", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json index a75637780..148b39055 100644 --- a/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.8 mm nozzle, it has a slightly smaller layer height, and results in slightly less but still apparent layer lines and slightly higher printing quality, but longer printing time in some printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json index f259218f1..d09c89ecb 100644 --- a/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in more apparent layer lines and lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json index 2c7cb9ba8..15ba67645 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "It has a very big layer height, and results in very apparent layer lines, low printing quality and general printing time.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json index dbf825510..1005112ff 100644 --- a/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.6 mm nozzle, it has a bigger layer height, and results in much more apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", diff --git a/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json index 77c258594..40c694d89 100644 --- a/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.8 mm nozzle, it has a bigger layer height, and results in very apparent layer lines and much lower printing quality, but shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", diff --git a/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json index 64d3187b4..9b80a1a5d 100644 --- a/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json @@ -7,6 +7,8 @@ "instantiation": "true", "description": "Compared with the default profile of a 0.8 mm nozzle, it has a much bigger layer height, and results in extremely apparent layer lines and much lower printing quality, but much shorter printing time in some printing cases.", "elefant_foot_compensation": "0.15", + "smooth_coefficient": "150", + "overhang_totally_speed": "50", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", diff --git a/resources/profiles/BBL/process/fdm_process_common.json b/resources/profiles/BBL/process/fdm_process_common.json index 921718b99..c68411dbb 100644 --- a/resources/profiles/BBL/process/fdm_process_common.json +++ b/resources/profiles/BBL/process/fdm_process_common.json @@ -67,5 +67,7 @@ "prime_tower_width": "60", "xy_hole_compensation": "0", "xy_contour_compensation": "0", - "compatible_printers": [] + "compatible_printers": [], + "smooth_coefficient": "80", + "overhang_totally_speed": "24" } \ No newline at end of file diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp index 30f06f21d..676acb4c7 100644 --- a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp +++ b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp @@ -264,17 +264,22 @@ double ExtrusionLine::area() const } // namespace Slic3r::Arachne namespace Slic3r { -void extrusion_paths_append(ExtrusionPaths &dst, const ClipperLib_Z::Paths &extrusion_paths, const ExtrusionRole role, const Flow &flow) +void extrusion_paths_append(ExtrusionPaths &dst, const ClipperLib_Z::Paths &extrusion_paths, const ExtrusionRole role, const Flow &flow, int overhang) { for (const ClipperLib_Z::Path &extrusion_path : extrusion_paths) { ThickPolyline thick_polyline = Arachne::to_thick_polyline(extrusion_path); - Slic3r::append(dst, thick_polyline_to_multi_path(thick_polyline, role, flow, scaled(0.05), float(SCALED_EPSILON)).paths); + Slic3r::append(dst, thick_polyline_to_multi_path(thick_polyline, role, flow, scaled(0.05), float(SCALED_EPSILON), overhang).paths); } } -void extrusion_paths_append(ExtrusionPaths &dst, const Arachne::ExtrusionLine &extrusion, const ExtrusionRole role, const Flow &flow) +void extrusion_paths_append(ExtrusionPaths &dst, const Arachne::ExtrusionLine &extrusion, const ExtrusionRole role, const Flow &flow, int overhang) { ThickPolyline thick_polyline = Arachne::to_thick_polyline(extrusion); - Slic3r::append(dst, thick_polyline_to_multi_path(thick_polyline, role, flow, scaled(0.05), float(SCALED_EPSILON)).paths); + Slic3r::append(dst, thick_polyline_to_multi_path(thick_polyline, role, flow, scaled(0.05), float(SCALED_EPSILON), overhang).paths); +} + +void extrusion_path_append(ExtrusionPaths &dst, const ThickPolyline &thick_polyline, const ExtrusionRole role, const Flow &flow, int overhang) +{ + Slic3r::append(dst, thick_polyline_to_multi_path(thick_polyline, role, flow, scaled(0.05), float(SCALED_EPSILON), overhang).paths); } } // namespace Slic3r \ No newline at end of file diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.hpp b/src/libslic3r/Arachne/utils/ExtrusionLine.hpp index 7ac1a3c4c..fda492475 100644 --- a/src/libslic3r/Arachne/utils/ExtrusionLine.hpp +++ b/src/libslic3r/Arachne/utils/ExtrusionLine.hpp @@ -299,9 +299,9 @@ using VariableWidthLines = std::vector; //mm3_per_mm = rhs.mm3_per_mm; this->width = rhs.width; this->height = rhs.height; + this->smooth_speed = rhs.smooth_speed; this->overhang_degree = rhs.overhang_degree; this->curve_degree = rhs.curve_degree; this->polyline = rhs.polyline; @@ -210,6 +216,7 @@ public: this->mm3_per_mm = rhs.mm3_per_mm; this->width = rhs.width; this->height = rhs.height; + this->smooth_speed = rhs.smooth_speed; this->overhang_degree = rhs.overhang_degree; this->curve_degree = rhs.curve_degree; this->polyline = std::move(rhs.polyline); diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 8d5483f81..ddc9dfdfc 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -79,6 +79,8 @@ static const float g_min_purge_volume = 100.f; static const float g_purge_volume_one_time = 135.f; static const int g_max_flush_count = 4; static const size_t g_max_label_object = 64; +static const double smooth_speed_step = 10; +static const double not_split_length = scale_(1.0); Vec2d travel_point_1; Vec2d travel_point_2; @@ -3933,6 +3935,16 @@ static bool has_overhang_path_on_slope(const ExtrusionLoop &loop, double slope_l return false; } +static std::map overhang_speed_key_map = +{ + {1, "overhang_1_4_speed"}, + {2, "overhang_2_4_speed"}, + {3, "overhang_3_4_speed"}, + {4, "overhang_4_4_speed"}, + {5, "overhang_totally_speed"}, + {6, "bridge_speed"}, +}; + double GCode::get_path_speed(const ExtrusionPath &path) { double min_speed = double(m_config.slow_down_min_speed.get_at(m_writer.extruder()->id())); @@ -3952,7 +3964,9 @@ double GCode::get_path_speed(const ExtrusionPath &path) new_speed = get_overhang_degree_corr_speed(speed, path.overhang_degree); speed = new_speed == 0.0 ? speed : new_speed; } - } else if (path.role() == erOverhangPerimeter || path.role() == erBridgeInfill || path.role() == erSupportTransition) { + } else if (path.role() == erOverhangPerimeter && path.overhang_degree == 5) + speed = m_config.get_abs_value("overhang_totally_speed"); + else if (path.role() == erOverhangPerimeter || path.role() == erBridgeInfill || path.role() == erSupportTransition) { speed = m_config.get_abs_value("bridge_speed"); } auto _mm3_per_mm = path.mm3_per_mm * double(m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio.value : 1); @@ -3977,6 +3991,7 @@ double GCode::get_path_speed(const ExtrusionPath &path) // cap speed with max_volumetric_speed anyway (even if user is not using autospeed) speed = std::min(speed, extrude_speed); } + return speed; } @@ -4072,6 +4087,9 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou // BBS: slowdown speed to improve seam, to be fix, cooling need to be apply correctly //new_loop.target_speed = get_path_speed(new_loop.starts.back()); //new_loop.slowdown_slope_speed(); + // BBS: smooth speed of discontinuity areas + if (m_config.detect_overhang_wall && m_config.smooth_speed_discontinuity_area && (loop.role() == erExternalPerimeter || loop.role() == erPerimeter)) + smooth_speed_discontinuity_area(new_loop.paths); // Then extrude it for (const auto &p : new_loop.get_all_paths()) { gcode += this->_extrude(*p, description, speed_for_path(*p)); @@ -4093,6 +4111,10 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou } if (!enable_seam_slope || slope_has_overhang) { + // BBS: smooth speed of discontinuity areas + if (m_config.detect_overhang_wall && m_config.smooth_speed_discontinuity_area && (loop.role() == erExternalPerimeter || loop.role() == erPerimeter)) + smooth_speed_discontinuity_area(paths); + for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) { gcode += this->_extrude(*path, description, speed_for_path(*path)); } @@ -4375,14 +4397,19 @@ void GCode::GCodeOutputStream::write_format(const char* format, ...) va_end(args); } -static std::map overhang_speed_key_map = +// BBS: f(x)=2x^2 +double GCode::mapping_speed(double dist) { - {1, "overhang_1_4_speed"}, - {2, "overhang_2_4_speed"}, - {3, "overhang_3_4_speed"}, - {4, "overhang_4_4_speed"}, - {5, "bridge_speed"}, -}; + if (dist <= 0) + return 0; + return this->config().smooth_coefficient * pow(dist, 2); +} + +double GCode::get_speed_coor_x(double speed){ + + double temp = speed / this->config().smooth_coefficient; + return sqrt(temp); +} double GCode::get_overhang_degree_corr_speed(float normal_speed, double path_degree) { @@ -4407,6 +4434,269 @@ double GCode::get_overhang_degree_corr_speed(float normal_speed, double path_deg return speed_out; } +static bool need_smooth_speed(const ExtrusionPath &other_path, const ExtrusionPath &this_path) +{ + if (this_path.smooth_speed - other_path.smooth_speed > smooth_speed_step) + return true; + + return false; +} + +static void append_split_line(bool split_from_left, Polyline &polyline, Point p1, Point p2) +{ + if (split_from_left) { + polyline.append(p1); + polyline.append(p2); + } else { + polyline.append(p2); + polyline.append(p1); + } +} + +ExtrusionPaths GCode::split_and_mapping_speed(double &other_path_v, double &final_v, ExtrusionPath &this_path, double max_smooth_length, bool split_from_left) +{ + ExtrusionPaths splited_path; + if (this_path.length() <= 0 || this_path.polyline.points.size() < 2) { + return splited_path; + } + + // reverse if this slowdown the speed + Polyline input_polyline = this_path.polyline; + if (!split_from_left) + std::reverse(input_polyline.begin(), input_polyline.end()); + + double this_path_x = scale_(get_speed_coor_x(final_v)); + double x_base = scale_(get_speed_coor_x(other_path_v)); + + double smooth_length = this_path_x - x_base; + + // this length not support to get final v, adjust final v + if (smooth_length > max_smooth_length) + final_v = mapping_speed(unscale_(x_base + max_smooth_length)); + + double max_step_length = scale_(1.0); // cut path if the path too long + double min_step_length = scale_(0.4); // cut step + + double smooth_length_count = 0; + double split_line_speed = 0; + Point line_start_pt = input_polyline.points.front(); + Point line_end_pt = input_polyline.points[1]; + bool get_next_line = false; + size_t end_pt_idx = 1; + + auto insert_speed = [this](double line_lenght, double &pos_x, double &smooth_length_count, double target_v) { + pos_x += line_lenght; + double pos_x_speed = mapping_speed(unscale_(pos_x)); + smooth_length_count += line_lenght; + + if (pos_x_speed > target_v) + pos_x_speed = target_v; + + return pos_x_speed; + }; + + while (end_pt_idx < input_polyline.points.size()) { + // move to next line + if (get_next_line) { + line_start_pt = input_polyline.points[end_pt_idx - 1]; + line_end_pt = input_polyline.points[end_pt_idx]; + } + + Polyline polyline; + Line line(line_start_pt, line_end_pt); + + // split polyline and set speed + if (line.length() < max_step_length || line.length() - min_step_length < min_step_length / 2) { + split_line_speed = insert_speed(line.length(), x_base, smooth_length_count, final_v); + append_split_line(split_from_left, polyline, line_start_pt, line_end_pt); + end_pt_idx++; + get_next_line = true; + } else { + // path is too long, split it + double rate = min_step_length / line.length(); + Point insert_p = line.a + (line.b - line.a) * rate; + + split_line_speed = insert_speed(min_step_length, x_base, smooth_length_count, final_v); + append_split_line(split_from_left, polyline, line_start_pt, insert_p); + + line_start_pt = insert_p; + get_next_line = false; + } + + ExtrusionPath path_step(polyline, this_path); + path_step.smooth_speed = split_line_speed; + splited_path.push_back(std::move(path_step)); + + // stop condition + if (split_line_speed >= final_v) break; + } + + if (!split_from_left) + std::reverse(input_polyline.points.begin(), input_polyline.points.end()); + // get_remain_path + if (end_pt_idx < input_polyline.points.size()) { + // split at index or split at corr length + Polyline p1, p2; + if( !split_from_left ) { + input_polyline.split_at_length(input_polyline.length() - smooth_length_count, &p1, &p2); + this_path.polyline = p1; + } else { + input_polyline.split_at_length(smooth_length_count, &p1, &p2); + this_path.polyline = p2; + } + + } else { + this_path.polyline.clear(); + } + + // reverse paths if this start from right + if (!split_from_left) + std::reverse(splited_path.begin(), splited_path.end()); + + return splited_path; +} + +ExtrusionPaths GCode::merge_same_speed_paths(const ExtrusionPaths &paths) +{ + ExtrusionPaths output_paths; + + size_t path_idx = 0; + int merge_start = 0; + ExtrusionPath merge_path; + for (; path_idx < paths.size(); path_idx++) { + ExtrusionPath path = paths[path_idx]; + path.smooth_speed = get_path_speed(path); + + // 100% overhang speed will not to set smooth speed + if (path.role() == erOverhangPerimeter) { + if (!merge_path.empty()) + output_paths.push_back(std::move(merge_path)); + output_paths.push_back(std::move(path)); + merge_start = path_idx + 1; + continue; + } + + if (merge_start == path_idx) { + merge_path = path; + continue; + } + + // merge path with same speed + if (merge_path.smooth_speed == path.smooth_speed) { + merge_path.polyline.append(path.polyline); + } else { + output_paths.push_back(std::move(merge_path)); + merge_path = path; + } + } + + if (!merge_path.empty()) + output_paths.push_back(std::move(merge_path)); + + return output_paths; +} + +static void set_short_and_discontinuity_speed_line(ExtrusionPaths &paths) +{ + for (size_t path_idx = 0; path_idx < paths.size(); path_idx++) { + ExtrusionPath &path = paths[path_idx]; + double path_length = path.polyline.length(); + + if (path_length > not_split_length) continue; + + bool smooth_left_path = false; + bool smooth_right_path = false; + // first line do not need to smooth speed on left + // prev line speed may change + if (path_idx > 0) + smooth_left_path = need_smooth_speed(paths[path_idx - 1], path); + + // last line do not need to smooth speed on right + if (path_idx < paths.size() - 1) + smooth_right_path = need_smooth_speed(paths[path_idx + 1], path); + + if (!(smooth_left_path || smooth_right_path)) + continue; + + //reset speed + if (smooth_left_path) { + path.smooth_speed = paths[path_idx - 1].smooth_speed; + } else { + path.smooth_speed = paths[path_idx + 1].smooth_speed; + } + } +} + +ExtrusionPaths GCode::set_speed_transition(ExtrusionPaths &paths) +{ + ExtrusionPaths interpolated_paths; + for (int path_idx = 0; path_idx < paths.size(); path_idx++) { + // update path + ExtrusionPath &path = paths[path_idx]; + + double this_path_speed = 0; + // 100% overhang speed will not to set smooth speed + if (path.role() == erOverhangPerimeter) { + interpolated_paths.push_back(path); + continue; + } + + bool smooth_left_path = false; + bool smooth_right_path = false; + // first line do not need to smooth speed on left + // prev line speed may change + if (path_idx > 0) + smooth_left_path = need_smooth_speed(paths[path_idx - 1], path); + + // first line do not need to smooth speed on right + if (path_idx < paths.size() - 1) + smooth_right_path = need_smooth_speed(paths[path_idx + 1], path); + + // get smooth length + double max_smooth_path_length = path.length(); + if (smooth_right_path && smooth_left_path) max_smooth_path_length /= 2; + + // smooth left + ExtrusionPaths left_split_paths; + if (smooth_left_path) { + left_split_paths = split_and_mapping_speed(paths[path_idx - 1].smooth_speed, path.smooth_speed, path, max_smooth_path_length); + if (!left_split_paths.empty()) interpolated_paths.insert(interpolated_paths.end(), left_split_paths.begin(), left_split_paths.end()); + max_smooth_path_length = path.length(); + } + + // smooth right + ExtrusionPaths right_split_paths; + if (smooth_right_path) { + right_split_paths = split_and_mapping_speed(paths[path_idx + 1].smooth_speed, path.smooth_speed, path, max_smooth_path_length, false); } + + if (!path.empty()) + interpolated_paths.push_back(path); + + if (!right_split_paths.empty()) + interpolated_paths.insert(interpolated_paths.end(), right_split_paths.begin(), right_split_paths.end()); + } + + return interpolated_paths; +} + +void GCode::smooth_speed_discontinuity_area(ExtrusionPaths &paths) { + + if (paths.size() <= 1) + return; + + //step 1 merge same speed path + size_t path_tail_pos = 0; + ExtrusionPaths prepare_paths = merge_same_speed_paths(paths); + + //step 2 set too short path speed + set_short_and_discontinuity_speed_line(prepare_paths); + + //step 3 split path + ExtrusionPaths inter_paths; + inter_paths =set_speed_transition(prepare_paths); + paths = std::move(inter_paths); +} + std::string GCode::_extrude(const ExtrusionPath &path, std::string description, double speed, bool is_first_slope) { std::string gcode; @@ -4500,18 +4790,25 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, if (speed == -1) { if (path.role() == erPerimeter) { speed = m_config.get_abs_value("inner_wall_speed"); - if (m_config.enable_overhang_speed.value) { + if (m_config.detect_overhang_wall && m_config.smooth_speed_discontinuity_area && path.smooth_speed != 0) + speed = path.smooth_speed; + else if (m_config.enable_overhang_speed.value) { double new_speed = 0; new_speed = get_overhang_degree_corr_speed(speed, path.overhang_degree); speed = new_speed == 0.0 ? speed : new_speed; } } else if (path.role() == erExternalPerimeter) { speed = m_config.get_abs_value("outer_wall_speed"); - if (m_config.enable_overhang_speed.value ) { + if (m_config.detect_overhang_wall && m_config.smooth_speed_discontinuity_area && path.smooth_speed != 0) + speed = path.smooth_speed; + else if (m_config.enable_overhang_speed.value) { double new_speed = 0; new_speed = get_overhang_degree_corr_speed(speed, path.overhang_degree); + speed = new_speed == 0.0 ? speed : new_speed; } + } else if (path.role() == erOverhangPerimeter && path.overhang_degree == 5) { + speed = m_config.get_abs_value("overhang_totally_speed"); } else if (path.role() == erOverhangPerimeter || path.role() == erBridgeInfill || path.role() == erSupportTransition) { speed = m_config.get_abs_value("bridge_speed"); } else if (path.role() == erInternalInfill) { diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 361e45fe6..6a19117bd 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -342,6 +342,9 @@ private: std::string extrude_multi_path(ExtrusionMultiPath multipath, std::string description = "", double speed = -1.); std::string extrude_path(ExtrusionPath path, std::string description = "", double speed = -1.); + //smooth speed function + void smooth_speed_discontinuity_area(ExtrusionPaths &paths); + ExtrusionPaths merge_same_speed_paths(const ExtrusionPaths &paths); // Extruding multiple objects with soluble / non-soluble / combined supports // on a multi-material printer, trying to minimize tool switches. // Following structures sort extrusions by the extruder ID, by an order of objects and object islands. @@ -514,8 +517,12 @@ private: int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const; std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1, bool is_first_slope = false); + ExtrusionPaths set_speed_transition(ExtrusionPaths &paths); + ExtrusionPaths split_and_mapping_speed(double &other_path_v, double &final_v, ExtrusionPath &this_path, double max_smooth_length, bool split_from_left = true); double get_path_speed(const ExtrusionPath &path); double get_overhang_degree_corr_speed(float speed, double path_degree); + double mapping_speed(double dist); + double get_speed_coor_x(double speed); void print_machine_envelope(GCodeOutputStream &file, Print &print); void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait); diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index ebb421dba..0a2cc8a24 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -417,6 +417,34 @@ std::pair PerimeterGenerator::dist_boundary(double width) return out; } +static void detect_bridge_wall(const PerimeterGenerator &perimeter_generator, ExtrusionPaths &paths, const Polylines &remain_polines, ExtrusionRole role, double mm3_per_mm, float width, float height) +{ + for (Polyline poly : remain_polines) { + // check if the line is straight line, which mean if the wall is bridge + Line line(poly.first_point(), poly.last_point()); + if (line.length() < poly.length()) { + extrusion_paths_append(paths, + std::move(poly), + overhang_sampling_number - 1, + int(0), + role, + mm3_per_mm, + width, + height); + continue; + } + // bridge wall + extrusion_paths_append(paths, + std::move(poly), + overhang_sampling_number, + int(0), + role, + mm3_per_mm, + width, + height); + } +} + static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perimeter_generator, const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls) { @@ -557,25 +585,22 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime if (remain_polines.size() != 0) { if (!((perimeter_generator.object_config->enable_support || perimeter_generator.object_config->enforce_support_layers > 0) && perimeter_generator.object_config->support_top_z_distance.value == 0)) { - extrusion_paths_append( - paths, - std::move(remain_polines), - overhang_sampling_number - 1, - int(0), - erOverhangPerimeter, - perimeter_generator.mm3_per_mm_overhang(), - perimeter_generator.overhang_flow.width(), - perimeter_generator.overhang_flow.height()); + //detect if the overhang perimeter is bridge + detect_bridge_wall(perimeter_generator, + paths, + remain_polines, + erOverhangPerimeter, + perimeter_generator.mm3_per_mm_overhang(), + perimeter_generator.overhang_flow.width(), + perimeter_generator.overhang_flow.height()); } else { - extrusion_paths_append( - paths, - std::move(remain_polines), - overhang_sampling_number - 1, - int(0), - role, - extrusion_mm3_per_mm, - extrusion_width, - (float)perimeter_generator.layer_height); + detect_bridge_wall( perimeter_generator, + paths, + remain_polines, + role, + extrusion_mm3_per_mm, + extrusion_width, + (float)perimeter_generator.layer_height); } } @@ -825,6 +850,30 @@ static void smooth_overhang_level(ExtrusionPaths &paths) } } +static void detect_brigde_wall_arachne(const PerimeterGenerator &perimeter_generator, ExtrusionPaths &paths, const ClipperLib_Z::Paths &path_overhang, const ExtrusionRole role, const Flow &flow) +{ + for (ClipperLib_Z::Path path : path_overhang) { + // check if the line is straight line, which mean if the wall is bridge + ThickPolyline thick_polyline = Arachne::to_thick_polyline(path); + + Line line(thick_polyline.front(), thick_polyline.back()); + if (line.length() < thick_polyline.length()) { + extrusion_path_append(paths, + std::move(thick_polyline), + role, + flow, + overhang_sampling_number - 1); + continue; + } + + extrusion_path_append(paths, + std::move(thick_polyline), + role, + flow, + overhang_sampling_number); + } +} + static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& perimeter_generator, std::vector& pg_extrusions) { ExtrusionEntityCollection extrusion_coll; @@ -841,9 +890,7 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p ExtrusionPaths paths; // detect overhanging/bridging perimeters - if (perimeter_generator.config->detect_overhang_wall && perimeter_generator.layer_id > perimeter_generator.object_config->raft_layers - && !((perimeter_generator.object_config->enable_support || perimeter_generator.object_config->enforce_support_layers > 0) && - perimeter_generator.object_config->support_top_z_distance.value == 0)) { + if (perimeter_generator.config->detect_overhang_wall && perimeter_generator.layer_id > perimeter_generator.object_config->raft_layers) { ClipperLib_Z::Path extrusion_path; extrusion_path.reserve(extrusion->size()); BoundingBox extrusion_path_bbox; @@ -928,9 +975,15 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p // get overhang paths by checking what parts of this loop fall // outside the grown lower slices (thus where the distance between // the loop centerline and original lower slices is >= half nozzle diameter - extrusion_paths_append(paths, clip_extrusion(extrusion_path, lower_slices_paths, ClipperLib_Z::ctDifference), erOverhangPerimeter, - perimeter_generator.overhang_flow); + // detect if the overhang perimeter is bridge + ClipperLib_Z::Paths path_overhang = clip_extrusion(extrusion_path, lower_slices_paths, ClipperLib_Z::ctDifference); + bool zero_z_support = (perimeter_generator.object_config->enable_support || perimeter_generator.object_config->enforce_support_layers > 0) && perimeter_generator.object_config->support_top_z_distance.value == 0; + + if(zero_z_support) + detect_brigde_wall_arachne(perimeter_generator, paths, path_overhang, role, is_external ? perimeter_generator.ext_perimeter_flow : perimeter_generator.perimeter_flow); + else + detect_brigde_wall_arachne(perimeter_generator, paths, path_overhang, erOverhangPerimeter, perimeter_generator.overhang_flow); // Reapply the nearest point search for starting point. // We allow polyline reversal because Clipper may have randomly reversed polylines during clipping. // Arachne sometimes creates extrusion with zero-length (just two same endpoints); @@ -974,8 +1027,7 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p } } - } - else { + } else { extrusion_paths_append(paths, *extrusion, role, is_external ? perimeter_generator.ext_perimeter_flow : perimeter_generator.perimeter_flow); } diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 825622056..07a981ea1 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -793,8 +793,9 @@ bool Preset::has_cali_lines(PresetBundle* preset_bundle) static std::vector s_Preset_print_options { "layer_height", "initial_layer_print_height", "wall_loops", "slice_closing_radius", "spiral_mode", "spiral_mode_smooth", "spiral_mode_max_xy_smoothing", "slicing_mode", - "top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", - "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", + "top_shell_layers", "top_shell_thickness", "bottom_shell_layers", "bottom_shell_thickness", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", + "detect_overhang_wall", + "smooth_speed_discontinuity_area","smooth_coefficient", "seam_position", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "sparse_infill_anchor", "sparse_infill_anchor_max", "top_surface_pattern", "bottom_surface_pattern", "internal_solid_infill_pattern", "infill_direction", "bridge_angle", "minimum_sparse_infill_area", "reduce_infill_retraction", "ironing_pattern", "ironing_type", @@ -833,7 +834,7 @@ static std::vector s_Preset_print_options { "tree_support_branch_diameter", "detect_narrow_internal_solid_infill", "gcode_add_line_number", "enable_arc_fitting", "precise_z_height", "infill_combination", /*"adaptive_layer_height",*/ - "support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", + "support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", "overhang_totally_speed", "initial_layer_infill_speed", "top_one_wall_type", "top_area_threshold", "only_one_wall_first_layer", "timelapse_type", "internal_bridge_support_thickness", "wall_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index cafadf292..bf0775376 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -879,12 +879,22 @@ void PrintConfigDef::init_fff_params() def->label = "[75%, 100%)"; def->category = L("Speed"); def->full_label = "[75%, 100%)"; - //def->tooltip = L("Speed for line of wall which has degree of overhang between 75% and 100% line width. 0 means using original wall speed"); + // def->tooltip = L("Speed for line of wall which has degree of overhang between 75% and 100% line width. 0 means using original wall speed"); def->sidetext = L("mm/s"); def->min = 0; def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("overhang_totally_speed", coFloat); + def->label = "100% overhang wall (not bridge)"; + def->category = L("Speed"); + def->tooltip = L("Speed for line of wall which has degree of overhang over 100% line width, but the wall is not a bridge wall."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comAdvanced; + def->nullable = true; + def->set_default_value(new ConfigOptionFloat{24}); + def = this->add("bridge_speed", coFloat); def->label = L("Bridge"); def->category = L("Speed"); @@ -2541,6 +2551,20 @@ void PrintConfigDef::init_fff_params() def->mode = comDevelop; def->set_default_value(new ConfigOptionBool(true)); + def = this->add("smooth_speed_discontinuity_area", coBool); + def->label = L("Smooth speed discontinuity area"); + def->category = L("Quality"); + def->tooltip = L("Add the speed transition between discontinuity area."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(true)); + + def = this->add("smooth_coefficient", coFloat); + def->label = L("Smooth coefficient"); + def->category = L("Quality"); + def->tooltip = L("The smaller the number, the longer the speed transition path."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(80)); + def = this->add("wall_filament", coInt); //def->label = L("Walls"); //def->category = L("Extruders"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index ed6a1d5ec..872cd83be 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -777,6 +777,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, bottom_shell_thickness)) ((ConfigOptionFloat, bridge_angle)) ((ConfigOptionFloat, bridge_flow)) + ((ConfigOptionFloat, overhang_totally_speed)) ((ConfigOptionFloat, bridge_speed)) ((ConfigOptionBool, ensure_vertical_shell_thickness)) ((ConfigOptionEnum, top_surface_pattern)) @@ -806,6 +807,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, ironing_speed)) // Detect bridging perimeters ((ConfigOptionBool, detect_overhang_wall)) + ((ConfigOptionBool, smooth_speed_discontinuity_area)) + ((ConfigOptionFloat, smooth_coefficient)) ((ConfigOptionInt, wall_filament)) ((ConfigOptionFloat, inner_wall_line_width)) ((ConfigOptionFloat, inner_wall_speed)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index cfa750f31..f373bc808 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -907,10 +907,13 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "wipe_speed" || opt_key == "support_speed" || opt_key == "support_interface_speed" + || opt_key == "smooth_speed_discontinuity_area" + || opt_key == "smooth_coefficient" || opt_key == "overhang_1_4_speed" || opt_key == "overhang_2_4_speed" || opt_key == "overhang_3_4_speed" || opt_key == "overhang_4_4_speed" + || opt_key == "overhang_totally_speed" || opt_key == "bridge_speed" || opt_key == "outer_wall_speed" || opt_key == "small_perimeter_speed" diff --git a/src/libslic3r/VariableWidth.cpp b/src/libslic3r/VariableWidth.cpp index c7c2a6908..b7c5fd174 100644 --- a/src/libslic3r/VariableWidth.cpp +++ b/src/libslic3r/VariableWidth.cpp @@ -2,7 +2,7 @@ namespace Slic3r { -ExtrusionMultiPath thick_polyline_to_multi_path(const ThickPolyline& thick_polyline, ExtrusionRole role, const Flow& flow, const float tolerance, const float merge_tolerance) +ExtrusionMultiPath thick_polyline_to_multi_path(const ThickPolyline& thick_polyline, ExtrusionRole role, const Flow& flow, const float tolerance, const float merge_tolerance, int overhang) { ExtrusionMultiPath multi_path; ExtrusionPath path(role); @@ -90,8 +90,10 @@ ExtrusionMultiPath thick_polyline_to_multi_path(const ThickPolyline& thick_polyl } } } - if (path.polyline.is_valid()) + if( path.polyline.is_valid() ) { + path.overhang_degree = overhang; multi_path.paths.emplace_back(std::move(path)); + } return multi_path; } diff --git a/src/libslic3r/VariableWidth.hpp b/src/libslic3r/VariableWidth.hpp index f6eca9708..311df2ccc 100644 --- a/src/libslic3r/VariableWidth.hpp +++ b/src/libslic3r/VariableWidth.hpp @@ -6,7 +6,7 @@ #include "Flow.hpp" namespace Slic3r { - ExtrusionMultiPath thick_polyline_to_multi_path(const ThickPolyline& thick_polyline, ExtrusionRole role, const Flow& flow, const float tolerance, const float merge_tolerance); + ExtrusionMultiPath thick_polyline_to_multi_path(const ThickPolyline& thick_polyline, ExtrusionRole role, const Flow& flow, const float tolerance, const float merge_tolerance, int overhang); void variable_width(const ThickPolylines& polylines, ExtrusionRole role, const Flow& flow, std::vector& out); } diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index ea7961bea..567a2339e 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -103,8 +103,8 @@ std::map> SettingsFactory::PART_CAT {"infill_combination", "",1}, {"infill_wall_overlap", "",1}, {"infill_direction", "",1}, {"bridge_angle", "",1},{"minimum_sparse_infill_area", "",1} }}, { L("Speed"), {{"outer_wall_speed", "",1},{"inner_wall_speed", "",2},{"sparse_infill_speed", "",3},{"top_surface_speed", "",4}, {"internal_solid_infill_speed", "",5}, - {"enable_overhang_speed", "",6}, {"overhang_1_4_speed", "",7}, {"overhang_2_4_speed", "",8}, {"overhang_3_4_speed", "",9}, {"overhang_4_4_speed", "",10}, - {"bridge_speed", "",11}, {"gap_infill_speed", "",12} + {"enable_overhang_speed", "",6}, {"overhang_1_4_speed", "",7}, {"overhang_2_4_speed", "",8}, {"overhang_3_4_speed", "",9}, {"overhang_4_4_speed", "",10}, {"overhang_totally_speed", "",11}, + {"bridge_speed", "",12}, {"gap_infill_speed", "",13} }} }; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index f25fa81c3..4bf2376e5 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1987,6 +1987,8 @@ void TabPrint::build() optgroup->append_single_option_line("top_area_threshold"); optgroup->append_single_option_line("only_one_wall_first_layer"); optgroup->append_single_option_line("detect_overhang_wall"); + optgroup->append_single_option_line("smooth_speed_discontinuity_area"); + optgroup->append_single_option_line("smooth_coefficient"); optgroup->append_single_option_line("reduce_crossing_wall"); optgroup->append_single_option_line("max_travel_detour_distance"); @@ -2042,6 +2044,7 @@ void TabPrint::build() line.append_option(optgroup->get_option("overhang_3_4_speed")); line.append_option(optgroup->get_option("overhang_4_4_speed")); optgroup->append_line(line); + optgroup->append_single_option_line("overhang_totally_speed"); optgroup->append_single_option_line("bridge_speed"); optgroup->append_single_option_line("gap_infill_speed"); optgroup->append_single_option_line("support_speed");