Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add small perimeter length in user interface #4593

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Slic3r/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ sub validate {
# --perimeters
die "Invalid value for --perimeters\n"
if $self->perimeters < 0;

die "Invalid value for --small-perimeter-length\n"
if $self->perimeters < 0;

# --solid-layers
die "Invalid value for --solid-layers\n" if defined $self->solid_layers && $self->solid_layers < 0;
Expand Down
10 changes: 5 additions & 5 deletions lib/Slic3r/GUI/PresetEditor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ sub options {
infill_every_layers infill_only_where_needed
solid_infill_every_layers fill_angle solid_infill_below_area
only_retract_when_crossing_perimeters infill_first
max_print_speed max_volumetric_speed
max_print_speed max_volumetric_speed small_perimeter_length
perimeter_speed small_perimeter_speed external_perimeter_speed infill_speed
solid_infill_speed top_solid_infill_speed support_material_speed
support_material_interface_speed bridge_speed gap_fill_speed
Expand Down Expand Up @@ -631,9 +631,9 @@ sub build {
{
my $optgroup = $page->new_optgroup('Speed for print moves');
$optgroup->append_single_option_line($_, undef, width => 100)
for qw(perimeter_speed small_perimeter_speed external_perimeter_speed
infill_speed solid_infill_speed top_solid_infill_speed
gap_fill_speed bridge_speed
for qw(perimeter_speed small_perimeter_speed small_perimeter_length
external_perimeter_speed infill_speed solid_infill_speed
top_solid_infill_speed gap_fill_speed bridge_speed
support_material_speed support_material_interface_speed
);
}
Expand Down Expand Up @@ -887,7 +887,7 @@ sub _update {
if (any { /$opt_key/ } qw(all_keys perimeters)) {
$self->get_field($_)->toggle($have_perimeters)
for qw(extra_perimeters thin_walls overhangs seam_position external_perimeters_first
external_perimeter_extrusion_width
external_perimeter_extrusion_width small_perimeter_length
perimeter_speed small_perimeter_speed external_perimeter_speed);
}

Expand Down
2 changes: 1 addition & 1 deletion src/GUI/Dialogs/PresetEditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class PrintEditor : public PresetEditor {
{
"layer_height"s, "first_layer_height"s,
"adaptive_slicing"s, "adaptive_slicing_quality"s, "match_horizontal_surfaces"s,
"perimeters"s, "spiral_vase"s,
"perimeters"s, "spiral_vase"s, "small_perimeter_length"s,
"top_solid_layers"s, "bottom_solid_layers"s,
"extra_perimeters"s, "avoid_crossing_perimeters"s, "thin_walls"s, "overhangs"s,
"seam_position"s, "external_perimeters_first"s,
Expand Down
2 changes: 1 addition & 1 deletion src/test/inputs/test_config/config_bundle_test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ skirt_distance = 6
skirt_height = 1
skirts = 1
small_perimeter_speed = 15
small_perimeter_length = 40
solid_infill_below_area = 70
solid_infill_every_layers = 0
solid_infill_extruder = 1
Expand Down Expand Up @@ -173,7 +174,6 @@ shortcuts = support_material
skirt_distance = 6
skirt_height = 1
skirts = 1
small_perimeter_speed = 15
solid_infill_below_area = 70
solid_infill_every_layers = 0
solid_infill_extruder = 1
Expand Down
2 changes: 1 addition & 1 deletion xs/src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
// apply the small perimeter speed
if (paths.front().is_perimeter()
&& !loop.has(erOverhangPerimeter)
&& loop.length() <= SMALL_PERIMETER_LENGTH
&& loop.length() <= scale_(this->config.get_abs_value("small_perimeter_length"))
&& speed == -1) {
speed = this->config.get_abs_value("small_perimeter_speed");
description = "small perimeter";
Expand Down
9 changes: 9 additions & 0 deletions xs/src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,15 @@ PrintConfigDef::PrintConfigDef()
def->enum_labels.push_back("auto");
def->default_value = new ConfigOptionFloatOrPercent(15, false);

def = this->add("small_perimeter_length", coFloat);
def->label = __TRANS("Small perimeter length");
def->category = __TRANS("Layers and Perimeters");
def->tooltip = __TRANS("This setting controls the lenghtof the small perimeters");
def->sidetext = "mm";
def->cli = "small-perimeter-length=f";
def->min = 0;
def->default_value = new ConfigOptionFloat(6.5*2*PI);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and leave this a 6.5 and change the usage in xs/src/libslic3r/GCode.cpp to
scale_(this->config.get_abs_value("small_perimeter_length")) * 2 * PI


def = this->add("solid_infill_below_area", coFloat);
def->label = __TRANS("Solid infill threshold area");
def->category = __TRANS("Infill");
Expand Down
2 changes: 2 additions & 0 deletions xs/src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig
ConfigOptionFloat perimeter_speed;
ConfigOptionInt perimeters;
ConfigOptionFloatOrPercent small_perimeter_speed;
ConfigOptionFloat small_perimeter_length;
ConfigOptionFloat solid_infill_below_area;
ConfigOptionInt solid_infill_extruder;
ConfigOptionFloatOrPercent solid_infill_extrusion_width;
Expand Down Expand Up @@ -305,6 +306,7 @@ class PrintRegionConfig : public virtual StaticPrintConfig
OPT_PTR(perimeter_speed);
OPT_PTR(perimeters);
OPT_PTR(small_perimeter_speed);
OPT_PTR(small_perimeter_length);
OPT_PTR(solid_infill_below_area);
OPT_PTR(solid_infill_extruder);
OPT_PTR(solid_infill_extrusion_width);
Expand Down
1 change: 0 additions & 1 deletion xs/src/libslic3r/libslic3r.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ constexpr auto PI = 3.141592653589793238;
// When extruding a closed loop, the loop is interrupted and shortened a bit to reduce the seam.
constexpr auto LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER = 0.15;
// Maximum perimeter length for the loop to apply the small perimeter speed.
constexpr coord_t SMALL_PERIMETER_LENGTH = scale_(6.5) * 2 * PI;
constexpr coordf_t INSET_OVERLAP_TOLERANCE = 0.4;
constexpr coordf_t EXTERNAL_INFILL_MARGIN = 3;
constexpr coord_t SCALED_EXTERNAL_INFILL_MARGIN = scale_(EXTERNAL_INFILL_MARGIN);
Expand Down