From dc81de37fd377bc5fa0292c9d2623afb85162043 Mon Sep 17 00:00:00 2001 From: "qing.zhang" Date: Fri, 17 Jan 2025 11:03:18 +0800 Subject: [PATCH] FIX:offset error of auto hole-contour compensation Jira: none Signed-off-by: qing.zhang Change-Id: Id806eaab2ddcb44d89ef587765e5396939920f5a --- resources/profiles/BBL.json | 2 +- .../BBL/filament/Bambu PET-CF @BBL H2D.json | 54 ++++++++++--------- .../Bambu PETG HF @BBL H2D 0.4 nozzle.json | 8 +-- .../Bambu PETG-CF @BBL H2D 0.4 nozzle.json | 8 +-- .../filament/Bambu PLA Basic @BBL H2D.json | 10 ++-- .../Bambu PLA-CF @BBL H2D 0.4 nozzle.json | 8 +-- .../BBL/filament/fdm_filament_common.json | 8 +-- .../BBL/process/fdm_process_common.json | 3 +- src/libslic3r/Layer.cpp | 4 +- src/libslic3r/Layer.hpp | 2 +- src/libslic3r/LayerRegion.cpp | 9 ++-- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 15 ++++-- src/libslic3r/PrintConfig.hpp | 1 + src/libslic3r/PrintObject.cpp | 3 +- src/slic3r/GUI/ConfigManipulation.cpp | 1 + src/slic3r/GUI/Tab.cpp | 1 + 17 files changed, 80 insertions(+), 59 deletions(-) diff --git a/resources/profiles/BBL.json b/resources/profiles/BBL.json index c21816ea7..88d81a9a3 100644 --- a/resources/profiles/BBL.json +++ b/resources/profiles/BBL.json @@ -1,7 +1,7 @@ { "name": "Bambulab", "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", - "version": "02.00.00.20", + "version": "02.00.00.21", "force_update": "0", "description": "the initial version of BBL configurations", "machine_model_list": [ diff --git a/resources/profiles/BBL/filament/Bambu PET-CF @BBL H2D.json b/resources/profiles/BBL/filament/Bambu PET-CF @BBL H2D.json index 9f437a3ea..a7bfb42f1 100644 --- a/resources/profiles/BBL/filament/Bambu PET-CF @BBL H2D.json +++ b/resources/profiles/BBL/filament/Bambu PET-CF @BBL H2D.json @@ -9,18 +9,6 @@ "chamber_temperatures": [ "60" ], - "counter_coef_2": [ - "3860" - ], - "counter_coef_3": [ - "-32000" - ], - "counter_limit_min": [ - "-35000" - ], - "counter_limit_max": [ - "33000" - ], "filament_deretraction_speed": [ "nil", "nil" @@ -93,18 +81,6 @@ "nil", "nil" ], - "hole_coef_2": [ - "-8000" - ], - "hole_coef_3": [ - "135000" - ], - "hole_limit_min": [ - "88000" - ], - "hole_limit_max": [ - "220000" - ], "nozzle_temperature": [ "270", "270" @@ -118,6 +94,36 @@ "Bambu Lab H2D 0.6 nozzle", "Bambu Lab H2D 0.8 nozzle" ], + "counter_coef_1": [ + "0" + ], + "counter_coef_2": [ + "3860" + ], + "counter_coef_3": [ + "-32000" + ], + "hole_coef_1": [ + "0" + ], + "hole_coef_2": [ + "-8000" + ], + "hole_coef_3": [ + "135000" + ], + "counter_limit_min": [ + "-350000" + ], + "counter_limit_max": [ + "330000" + ], + "hole_limit_min": [ + "880000" + ], + "hole_limit_max": [ + "2200000" + ], "filament_start_gcode": [ "; filament start gcode\nM145 P1 ; set airduct mode to heating mode\n" ], diff --git a/resources/profiles/BBL/filament/Bambu PETG HF @BBL H2D 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG HF @BBL H2D 0.4 nozzle.json index b05c4692f..67c5970ef 100644 --- a/resources/profiles/BBL/filament/Bambu PETG HF @BBL H2D 0.4 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG HF @BBL H2D 0.4 nozzle.json @@ -122,16 +122,16 @@ "135000" ], "counter_limit_min": [ - "-35000" + "-350000" ], "counter_limit_max": [ - "33000" + "330000" ], "hole_limit_min": [ - "88000" + "880000" ], "hole_limit_max": [ - "220000" + "2200000" ], "filament_start_gcode": [ "; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling" diff --git a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL H2D 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL H2D 0.4 nozzle.json index 36dda3a86..42211e269 100644 --- a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL H2D 0.4 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL H2D 0.4 nozzle.json @@ -119,16 +119,16 @@ "145000" ], "counter_limit_min": [ - "-35000" + "-350000" ], "counter_limit_max": [ - "30000" + "300000" ], "hole_limit_min": [ - "88000" + "880000" ], "hole_limit_max": [ - "220000" + "2200000" ], "filament_start_gcode": [ "; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling" diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL H2D.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL H2D.json index 145f321f2..46110b77d 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL H2D.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL H2D.json @@ -114,19 +114,19 @@ "-8000" ], "hole_coef_3": [ - "201150" + "151150" ], "counter_limit_min": [ - "-35000" + "-350000" ], "counter_limit_max": [ - "33000" + "330000" ], "hole_limit_min": [ - "88000" + "880000" ], "hole_limit_max": [ - "220000" + "2200000" ], "filament_start_gcode": [ "; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling" diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL H2D 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL H2D 0.4 nozzle.json index 713f3677a..47c695825 100644 --- a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL H2D 0.4 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL H2D 0.4 nozzle.json @@ -107,16 +107,16 @@ "197450" ], "counter_limit_min": [ - "-35000" + "-350000" ], "counter_limit_max": [ - "33000" + "330000" ], "hole_limit_min": [ - "88000" + "880000" ], "hole_limit_max": [ - "220000" + "2200000" ], "filament_start_gcode": [ "; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling" diff --git a/resources/profiles/BBL/filament/fdm_filament_common.json b/resources/profiles/BBL/filament/fdm_filament_common.json index 5f7c45d7e..666d55af9 100644 --- a/resources/profiles/BBL/filament/fdm_filament_common.json +++ b/resources/profiles/BBL/filament/fdm_filament_common.json @@ -211,16 +211,16 @@ "280000" ], "counter_limit_min": [ - "-40000" + "-400000" ], "counter_limit_max": [ - "50000" + "500000" ], "hole_limit_min": [ - "80000" + "800000" ], "hole_limit_max": [ - "250000" + "2500000" ], "circle_compensation_speed": [ "200" diff --git a/resources/profiles/BBL/process/fdm_process_common.json b/resources/profiles/BBL/process/fdm_process_common.json index 63213ed05..4a1725535 100644 --- a/resources/profiles/BBL/process/fdm_process_common.json +++ b/resources/profiles/BBL/process/fdm_process_common.json @@ -133,5 +133,6 @@ "xy_contour_compensation": "0", "xy_hole_compensation": "0", "z_direction_outwall_speed_continuous": "0", - "enable_circle_compensation": "0" + "enable_circle_compensation": "0", + "circle_compensation_manual_offset": "0" } \ No newline at end of file diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 8b7f2328e..0e8371f50 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -198,7 +198,7 @@ void Layer::make_perimeters(const AutoContourHolesCompensationParams &auto_conto (*layerm)->fill_surfaces.surfaces.clear(); if (this->object()->config().enable_circle_compensation) { SurfaceCollection copy_slices = (*layerm)->slices; - (*layerm)->auto_circle_compensation(copy_slices, auto_contour_holes_compensation_params); + (*layerm)->auto_circle_compensation(copy_slices, auto_contour_holes_compensation_params, scale_(this->object()->config().circle_compensation_manual_offset)); (*layerm)->make_perimeters(copy_slices, &(*layerm)->fill_surfaces, &(*layerm)->fill_no_overlap_expolygons, this->loop_nodes); } else (*layerm)->make_perimeters((*layerm)->slices, &(*layerm)->fill_surfaces, &(*layerm)->fill_no_overlap_expolygons, this->loop_nodes); @@ -227,7 +227,7 @@ void Layer::make_perimeters(const AutoContourHolesCompensationParams &auto_conto //BBS ExPolygons fill_no_overlap; if (this->object()->config().enable_circle_compensation) - layerm_config->auto_circle_compensation(new_slices, auto_contour_holes_compensation_params); + layerm_config->auto_circle_compensation(new_slices, auto_contour_holes_compensation_params, scale_(this->object()->config().circle_compensation_manual_offset)); layerm_config->make_perimeters(new_slices, &fill_surfaces, &fill_no_overlap, this->loop_nodes); // assign fill_surfaces to each layer diff --git a/src/libslic3r/Layer.hpp b/src/libslic3r/Layer.hpp index 598c79b87..0af013513 100644 --- a/src/libslic3r/Layer.hpp +++ b/src/libslic3r/Layer.hpp @@ -80,7 +80,7 @@ public: void slices_to_fill_surfaces_clipped(); void prepare_fill_surfaces(); //BBS - void auto_circle_compensation(SurfaceCollection &slices, const AutoContourHolesCompensationParams &auto_contour_holes_compensation_params); + void auto_circle_compensation(SurfaceCollection &slices, const AutoContourHolesCompensationParams &auto_contour_holes_compensation_params, float manual_offset = 0.0f); void make_perimeters(const SurfaceCollection &slices, SurfaceCollection* fill_surfaces, ExPolygons* fill_no_overlap, std::vector &loop_nodes); void process_external_surfaces(const Layer *lower_layer, const Polygons *lower_layer_covered); double infill_area_threshold() const; diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index 746ee9d29..030d1d76b 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -66,9 +66,10 @@ void LayerRegion::slices_to_fill_surfaces_clipped() } } -void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const AutoContourHolesCompensationParams &auto_contour_holes_compensation_params) +void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const AutoContourHolesCompensationParams &auto_contour_holes_compensation_params, float manual_offset) { - int filament_idx = this->region().config().wall_filament; + // filament is 1 base + int filament_idx = this->region().config().wall_filament - 1; double limited_speed = auto_contour_holes_compensation_params.circle_compensation_speed[filament_idx]; double counter_speed_coef = auto_contour_holes_compensation_params.counter_speed_coef[filament_idx] / 1e6; @@ -90,7 +91,7 @@ void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const Auto Point center; double diameter = 0; if (surface.expolygon.contour.is_approx_circle(max_deviation, max_variance, center, diameter)) { - double offset_value = counter_speed_coef * limited_speed + counter_diameter_coef * diameter + counter_compensate_coef; + double offset_value = counter_speed_coef * limited_speed + counter_diameter_coef * diameter + counter_compensate_coef + manual_offset; if (offset_value < counter_limit_min_value) { offset_value = counter_limit_min_value; } else if (offset_value > counter_limit_max_value) { @@ -106,7 +107,7 @@ void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const Auto for (size_t i = 0; i < surface.expolygon.holes.size(); ++i) { Polygon &hole = surface.expolygon.holes[i]; if (hole.is_approx_circle(max_deviation, max_variance, center, diameter)) { - double offset_value = hole_speed_coef * limited_speed + hole_diameter_coef * diameter + hole_compensate_coef; + double offset_value = hole_speed_coef * limited_speed + hole_diameter_coef * diameter + hole_compensate_coef + manual_offset ; if (offset_value < hole_limit_min_value) { offset_value = hole_limit_min_value; } else if (offset_value > hole_limit_max_value) { diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 6805c9cc5..a3d7aa184 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -880,7 +880,7 @@ static std::vector s_Preset_print_options { "top_surface_line_width", "support_line_width", "infill_wall_overlap", "bridge_flow", "elefant_foot_compensation", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower", "prime_tower_width", "prime_tower_brim_width", "prime_tower_outer_first", "prime_tower_skip_points", "prime_volume", - "enable_circle_compensation", "circle_compensation_speed", + "enable_circle_compensation", "circle_compensation_speed", "circle_compensation_manual_offset", "counter_coef_1", "counter_coef_2", "counter_coef_3", "hole_coef_1", "hole_coef_2", "hole_coef_3", "counter_limit_min", "counter_limit_max", "hole_limit_min", "hole_limit_max", "diameter_limit", "wipe_tower_no_sparse_layers", "compatible_printers", "compatible_printers_condition", "inherits", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 36c4d2993..0dce20ae2 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -686,7 +686,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionBool(false)); def = this->add("z_direction_outwall_speed_continuous", coBool); - def->label = L("Z direction outwall speed continuous"); + def->label = L("Smoothing wall speed in z direction(experimental)"); def->category = L("Quality"); def->tooltip = L("Smoothing outwall speed in z direction to get better surface quality. Print time will increases. It is not work on spiral vase mode."); def->mode = comAdvanced; @@ -4177,11 +4177,20 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionBool(false)); def = this->add("enable_circle_compensation", coBool); - def->label = L("Auto holes-contour compensation"); - def->tooltip = L("enable_circle_compensation"); + def->label = L("Auto Circle Holes-contour Compensation"); + def->tooltip = L("Expirment feature to compensate the circle holes and circle contour. " + "This feature is used to improve the accuracy of the circle holes and contour within the diameter below 50mm. " + "Only support PLA Basic, PLA CF, PET CF, PETG CF and PETG HF."); def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); + def = this->add("circle_compensation_manual_offset", coFloat); + def->label = L("User Customized Offset"); + def->sidetext = L("mm"); + def->tooltip = L("If you want to have tighter or looser assemble, you can set this value."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(0.0)); + def = this->add("circle_compensation_speed", coFloats); def->label = L("Circle Compensation Speed"); def->tooltip = L("circle_compensation_speed"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index f71ee01f8..9306ef9c1 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -828,6 +828,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, xy_contour_compensation)) //BBS auto hole contour compensation ((ConfigOptionBool, enable_circle_compensation)) + ((ConfigOptionFloat, circle_compensation_manual_offset)) ((ConfigOptionBool, flush_into_objects)) // BBS ((ConfigOptionBool, flush_into_infill)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index bec3355bb..5c88967ca 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -922,7 +922,8 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "initial_layer_line_width" || opt_key == "inner_wall_line_width" || opt_key == "infill_wall_overlap" - || opt_key == "enable_circle_compensation") { + || opt_key == "enable_circle_compensation" + || opt_key == "circle_compensation_manual_offset") { steps.emplace_back(posPerimeters); } else if (opt_key == "gap_infill_speed" || opt_key == "filter_out_gap_fill") { // Return true if gap-fill speed has changed from zero value to non-zero or from non-zero value to zero. diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 1bb1b93d7..c0384300a 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -732,6 +732,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in bool enable_auto_hole_and_contour_compensation = config->opt_bool("enable_circle_compensation"); toggle_field("xy_hole_compensation", !enable_auto_hole_and_contour_compensation); toggle_field("xy_contour_compensation", !enable_auto_hole_and_contour_compensation); + toggle_line("circle_compensation_manual_offset", enable_auto_hole_and_contour_compensation); } void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index a3b1a7c0e..966483924 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2037,6 +2037,7 @@ void TabPrint::build() optgroup->append_single_option_line("xy_contour_compensation", "xy-hole-contour-compensation"); optgroup->append_single_option_line("elefant_foot_compensation", "parameter/elephant-foot"); optgroup->append_single_option_line("enable_circle_compensation"); + optgroup->append_single_option_line("circle_compensation_manual_offset"); optgroup->append_single_option_line("precise_z_height"); optgroup = page->new_optgroup(L("Ironing"), L"param_ironing");