From 091da40ad70552bbd017fd0f145c9541f8066b5f Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Wed, 12 Jun 2024 12:02:51 +0300 Subject: [PATCH] Classic for first layer WIP --- src/libslic3r/Fill/Fill.cpp | 5 +++-- src/libslic3r/LayerRegion.cpp | 3 ++- src/libslic3r/Preset.cpp | 1 + src/libslic3r/PrintConfig.cpp | 7 +++++++ src/libslic3r/PrintConfig.hpp | 1 + src/libslic3r/PrintObject.cpp | 1 + src/slic3r/GUI/Tab.cpp | 1 + 7 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index dc5f2ce13c..1f85c5a7c1 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -486,7 +486,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: std::vector surface_fills = group_fills(*this); const Slic3r::BoundingBox bbox = this->object()->bounding_box(); const auto resolution = this->object()->print()->config().gcode_resolution.value; - const auto perimeter_generator = this->object()->config().perimeter_generator; + const auto perimeter_generator = this->id() == 0 && this->object()->config().first_layer_generator_classic ? PerimeterGeneratorType::Arachne : this->object()->config().perimeter_generator; #ifdef SLIC3R_DEBUG_SLICE_PROCESSING { @@ -550,7 +550,8 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive: params.anchor_length = surface_fill.params.anchor_length; params.anchor_length_max = surface_fill.params.anchor_length_max; params.resolution = resolution; - params.use_arachne = (perimeter_generator == PerimeterGeneratorType::Arachne && pattern == ipConcentric) || surface_fill.params.pattern == ipEnsuring; + params.use_arachne = ((perimeter_generator == PerimeterGeneratorType::Arachne && pattern == ipConcentric) || surface_fill.params.pattern == ipEnsuring) + && !(layerm.layer()->id() == 0 && this->object()->config().first_layer_generator_classic); params.layer_height = layerm.layer()->height; params.prefer_clockwise_movements = this->object()->print()->config().prefer_clockwise_movements; diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index bb56cabc48..58a27ae968 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -136,7 +136,8 @@ void LayerRegion::make_perimeters( auto perimeters_begin = uint32_t(m_perimeters.size()); auto gap_fills_begin = uint32_t(m_thin_fills.size()); auto fill_expolygons_begin = uint32_t(fill_expolygons.size()); - if (this->layer()->object()->config().perimeter_generator.value == PerimeterGeneratorType::Arachne && !spiral_vase) + if (this->layer()->object()->config().perimeter_generator.value == PerimeterGeneratorType::Arachne && !spiral_vase && + !(this->layer()->id()==0 && this->layer()->object()->config().first_layer_generator_classic)) PerimeterGenerator::process_arachne( // input: params, diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 9f4042e1b3..c828f1aac4 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -500,6 +500,7 @@ static std::vector s_Preset_print_options { "wipe_tower_width", "wipe_tower_cone_angle", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_bridging", "single_extruder_multi_material_priming", "mmu_segmented_region_max_width", "mmu_segmented_region_interlocking_depth", "wipe_tower_extruder", "wipe_tower_no_sparse_layers", "wipe_tower_extra_flow", "wipe_tower_extra_spacing", "compatible_printers", "compatible_printers_condition", "inherits", "perimeter_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle", + "first_layer_generator_classic", "wall_distribution_count", "min_feature_size", "min_bead_width", "max_bead_width", "top_one_perimeter_type", "only_one_perimeter_first_layer", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2a8d81aeac..9124bd296b 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3814,6 +3814,13 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(PerimeterGeneratorType::Arachne)); + def = this->add("first_layer_generator_classic", coBool); + def->label = L("Use classic for first layer"); + def->category = L("Layers and Perimeters"); + def->tooltip = L("Use classic perimeter for first layer."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("wall_transition_length", coFloatOrPercent); def->label = L("Perimeter transition length"); def->category = L("Advanced"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 2bfa191b0c..760aeeace5 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -622,6 +622,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, slice_closing_radius)) ((ConfigOptionEnum, slicing_mode)) ((ConfigOptionEnum, perimeter_generator)) + ((ConfigOptionBool, first_layer_generator_classic)) ((ConfigOptionFloatOrPercent, wall_transition_length)) ((ConfigOptionFloatOrPercent, wall_transition_filter_deviation)) ((ConfigOptionFloat, wall_transition_angle)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 0ff27a9319..4dd4bc452d 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -882,6 +882,7 @@ bool PrintObject::invalidate_state_by_config_options( steps.emplace_back(posSupportMaterial); } else if ( opt_key == "perimeter_generator" + || opt_key == "first_layer_generator_classic" || opt_key == "wall_transition_length" || opt_key == "wall_transition_filter_deviation" || opt_key == "wall_transition_angle" diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 39c77d1a8e..5d2264b845 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1466,6 +1466,7 @@ void TabPrint::build() optgroup->append_single_option_line("internal_first_on_overhangs", category_path + "external-perimeters-first"); optgroup->append_single_option_line("gap_fill_enabled", category_path + "fill-gaps"); optgroup->append_single_option_line("perimeter_generator"); + optgroup->append_single_option_line("first_layer_generator_classic"); optgroup = page->new_optgroup(L("Fuzzy skin (experimental)")); category_path = "fuzzy-skin_246186/#";