Skip to content

Commit

Permalink
Add 'only one perimeter on first layer' as doing it manually via modi…
Browse files Browse the repository at this point in the history
…fier wreck solid bottom layer count

#289
#584
#1566
  • Loading branch information
supermerill committed Sep 26, 2021
1 parent 092f777 commit 51d5b71
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 8 deletions.
13 changes: 7 additions & 6 deletions resources/ui_layout/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@ group:Horizontal shells
setting:solid_over_perimeters
setting:enforce_full_fill_volume
group:Quality
line:Only one perimeter on Top surfaces
setting:label$ :only_one_perimeter_top
line:Only one perimeter
setting:label_width$8:label$On first layer:only_one_perimeter_first_layer
setting:label_width$10:label$On top surfaces:only_one_perimeter_top
setting:label$Minimum width:sidetext_width$7:min_width_top_surface
end_line
line:Extra perimeters
setting:extra_perimeters_overhangs
setting:extra_perimeters_odd_layers
setting:label_width$8:extra_perimeters_overhangs
setting:label_width$10:extra_perimeters_odd_layers
end_line
setting:ensure_vertical_shell_thickness
line:Avoid crossing perimeters
setting:label$_:avoid_crossing_perimeters
setting:label$Not on first layer:avoid_crossing_not_first_layer
setting:label_width$12:label$Not on first layer:avoid_crossing_not_first_layer
setting:avoid_crossing_perimeters_max_detour
end_line
line:Overlapping external perimeter
setting:label$_:thin_perimeters
setting:label$Also for all perimeters:thin_perimeters_all
setting:label_width$12:label$Also for all perimeters:thin_perimeters_all
end_line
line:Thin walls
setting:label$_:thin_walls
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ void Layer::make_perimeters()
&& config.infill_dense == other_config.infill_dense
&& config.infill_dense_algo == other_config.infill_dense_algo
&& config.no_perimeter_unsupported_algo == other_config.no_perimeter_unsupported_algo
&& (this->id() == 0 || config.only_one_perimeter_first_layer == other_config.only_one_perimeter_first_layer)
&& config.only_one_perimeter_top == other_config.only_one_perimeter_top
&& config.only_one_perimeter_top_other_algo == other_config.only_one_perimeter_top_other_algo
&& config.overhangs_width_speed == other_config.overhangs_width_speed
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void PerimeterGenerator::process()
int loop_number = this->config->perimeters + surface.extra_perimeters - 1 + extra_odd_perimeter; // 0-indexed loops
surface_idx++;

if (this->config->only_one_perimeter_top && loop_number > 0 && this->upper_slices == NULL){
if ((layer->id() == 0 && this->config->only_one_perimeter_first_layer) || (this->config->only_one_perimeter_top && loop_number > 0 && this->upper_slices == NULL)){
loop_number = 0;
}

Expand Down Expand Up @@ -678,7 +678,7 @@ void PerimeterGenerator::process()
last = std::move(next_onion);

//store surface for top infill if only_one_perimeter_top
if(i==0 && config->only_one_perimeter_top && this->upper_slices != NULL){
if(i==0 && ((layer->id() == 0 && this->config->only_one_perimeter_first_layer) || (config->only_one_perimeter_top && this->upper_slices != NULL))){
if (this->config->only_one_perimeter_top_other_algo) {
//split the polygons with top/not_top
//get the offset from solid surface anchor
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ const std::vector<std::string>& Preset::print_options()
"extra_perimeters",
"extra_perimeters_odd_layers",
"extra_perimeters_overhangs",
"only_one_perimeter_first_layer",
"only_one_perimeter_top",
"only_one_perimeter_top_other_algo",
"ensure_vertical_shell_thickness",
Expand Down
7 changes: 7 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,12 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("only_one_perimeter_first_layer", coBool);
def->label = L("Only one perimeter on First layer");
def->category = OptionCategory::perimeter;
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("Only one perimeter on Top surfaces");
def->category = OptionCategory::perimeter;
Expand Down Expand Up @@ -5742,6 +5748,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = {
"no_perimeter_unsupported_algo",
"only_one_perimeter_top_other_algo",
"only_one_perimeter_top",
"only_one_perimeter_first_layer",
"over_bridge_flow_ratio",
"overhangs_reverse_threshold",
"overhangs_reverse",
Expand Down
2 changes: 2 additions & 0 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ class PrintRegionConfig : public StaticPrintConfig
ConfigOptionBool extra_perimeters;
ConfigOptionBool extra_perimeters_odd_layers;
ConfigOptionBool extra_perimeters_overhangs;
ConfigOptionBool only_one_perimeter_first_layer;
ConfigOptionBool only_one_perimeter_top;
ConfigOptionBool only_one_perimeter_top_other_algo;
ConfigOptionFloat fill_angle;
Expand Down Expand Up @@ -898,6 +899,7 @@ class PrintRegionConfig : public StaticPrintConfig
OPT_PTR(extra_perimeters);
OPT_PTR(extra_perimeters_odd_layers);
OPT_PTR(extra_perimeters_overhangs);
OPT_PTR(only_one_perimeter_first_layer);
OPT_PTR(only_one_perimeter_top);
OPT_PTR(only_one_perimeter_top_other_algo);
OPT_PTR(fill_angle);
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ namespace Slic3r {
opt_key == "gap_fill"
|| opt_key == "gap_fill_last"
|| opt_key == "gap_fill_min_area"
|| opt_key == "only_one_perimeter_first_layer"
|| opt_key == "only_one_perimeter_top"
|| opt_key == "only_one_perimeter_top_other_algo"
|| opt_key == "overhangs_width_speed"
Expand Down

0 comments on commit 51d5b71

Please sign in to comment.