Skip to content

Commit

Permalink
[FEATURE] Only one perimeter on first layer
Browse files Browse the repository at this point in the history
  • Loading branch information
mjonuschat committed Feb 19, 2024
1 parent dd828a6 commit be89655
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ void PerimeterGenerator::process_classic(
int loop_number = params.config.perimeters + surface.extra_perimeters - 1; // 0-indexed loops

// SuperSlicer: set the topmost layer to be one perimeter
if (loop_number > 0 && params.config.only_one_perimeter_top && upper_slices == nullptr)
if ((params.layer_id == 0 && params.config.only_one_perimeter_first_layer) || (loop_number > 0 && params.config.only_one_perimeter_top && upper_slices == nullptr))
loop_number = 0;

ExPolygons last = union_ex(surface.expolygon.simplify_p(params.scaled_resolution));
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ static std::vector<std::string> s_Preset_print_options {
"perimeter_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle",
"wall_distribution_count", "min_feature_size", "min_bead_width",
// SuperSlicer
"only_one_perimeter_top", "min_width_top_surface", "solid_fill_pattern",
"only_one_perimeter_first_layer", "only_one_perimeter_top", "min_width_top_surface", "solid_fill_pattern",
};

static std::vector<std::string> s_Preset_filament_options {
Expand Down
6 changes: 6 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,12 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(1));

def = this->add("only_one_perimeter_first_layer", coBool);
def->label = L("On First layer");
def->category = L("Layers and Perimeters");
def->tooltip = L("Use only one perimeter on first layer, to give more space to the top infill pattern.");
def->set_default_value(new ConfigOptionBool(false));

def = this->add("only_one_perimeter_top", coBool);
def->label = L("On top surfaces");
def->category = L("Layers and Perimeters");
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatOrPercent, top_solid_infill_speed))
((ConfigOptionBool, wipe_into_infill))
// SuperSlicer
((ConfigOptionBool, only_one_perimeter_first_layer))
((ConfigOptionBool, only_one_perimeter_top))
((ConfigOptionFloatOrPercent, min_width_top_surface))
((ConfigOptionEnum<InfillPattern>, solid_fill_pattern))
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,8 @@ bool PrintObject::invalidate_state_by_config_options(
// Brim is printed below supports, support invalidates brim and skirt.
steps.emplace_back(posSupportMaterial);
} else if (
opt_key == "only_one_perimeter_top") {
opt_key == "only_one_perimeter_first_layer"
|| opt_key == "only_one_perimeter_top") {
steps.emplace_back(posPerimeters);
} else if (
opt_key == "perimeters"
Expand Down
15 changes: 8 additions & 7 deletions src/slic3r/GUI/ConfigManipulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
double fill_density = config->option<ConfigOptionPercent>("fill_density")->value;

if (config->opt_bool("spiral_vase") &&
! (config->opt_int("perimeters") == 1 &&
! (config->opt_int("perimeters") == 1 &&
config->opt_int("top_solid_layers") == 0 &&
fill_density == 0 &&
! config->opt_bool("support_material") &&
Expand All @@ -102,7 +102,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
new_conf.set_key_value("fill_density", new ConfigOptionPercent(0));
new_conf.set_key_value("support_material", new ConfigOptionBool(false));
new_conf.set_key_value("support_material_enforce_layers", new ConfigOptionInt(0));
new_conf.set_key_value("thin_walls", new ConfigOptionBool(false));
new_conf.set_key_value("thin_walls", new ConfigOptionBool(false));
fill_density = 0;
support = false;
}
Expand All @@ -117,7 +117,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
}
}

if (config->opt_bool("wipe_tower") && config->opt_bool("support_material") &&
if (config->opt_bool("wipe_tower") && config->opt_bool("support_material") &&
// Organic supports are always synchronized with object layers as of now.
config->opt_enum<SupportMaterialStyle>("support_material_style") != smsOrganic) {
if (config->opt_float("support_material_contact_distance") == 0) {
Expand Down Expand Up @@ -288,7 +288,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
bool have_support_soluble = have_support_material && config->opt_float("support_material_contact_distance") == 0;
auto support_material_style = config->opt_enum<SupportMaterialStyle>("support_material_style");
for (auto el : { "support_material_style", "support_material_pattern", "support_material_with_sheath",
"support_material_spacing", "support_material_angle",
"support_material_spacing", "support_material_angle",
"support_material_interface_pattern", "support_material_interface_layers",
"dont_support_bridges", "support_material_extrusion_width", "support_material_contact_distance",
"support_material_xy_spacing" })
Expand All @@ -297,11 +297,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
toggle_field("support_material_bottom_contact_distance", have_support_material && ! have_support_soluble);
toggle_field("support_material_closing_radius", have_support_material && support_material_style == smsSnug);

const bool has_organic_supports = support_material_style == smsOrganic &&
(config->opt_bool("support_material") ||
const bool has_organic_supports = support_material_style == smsOrganic &&
(config->opt_bool("support_material") ||
config->opt_int("support_material_enforce_layers") > 0);
for (const std::string& key : { "support_tree_angle", "support_tree_angle_slow", "support_tree_branch_diameter",
"support_tree_branch_diameter_angle", "support_tree_branch_diameter_double_wall",
"support_tree_branch_diameter_angle", "support_tree_branch_diameter_double_wall",
"support_tree_tip_diameter", "support_tree_branch_distance", "support_tree_top_rate" })
toggle_field(key, has_organic_supports);

Expand Down Expand Up @@ -352,6 +352,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
toggle_field("min_bead_width", have_arachne);
toggle_field("thin_walls", !have_arachne);

toggle_field("only_one_perimeter_first_layer", !have_arachne);
toggle_field("only_one_perimeter_top", !have_arachne);
toggle_field("min_width_top_surface", have_perimeters && config->opt_bool("only_one_perimeter_top") && !have_arachne);
}
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/Tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Quality (slower slicing)"));
line = { L("Only one perimeter"), "" };
line.label_path = category_path + "only-one-perimeter-top-bottom";
line.append_option(optgroup->get_option("only_one_perimeter_first_layer"));
line.append_option(optgroup->get_option("only_one_perimeter_top"));
line.append_option(optgroup->get_option("min_width_top_surface"));
optgroup->append_line(line);
Expand Down

0 comments on commit be89655

Please sign in to comment.