diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index c515df76f7..17e7e08ce0 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -482,7 +482,7 @@ sub build { brim_connections_width brim_width support_material support_material_threshold support_material_enforce_layers raft_layers - support_material_pattern support_material_spacing support_material_angle + support_material_pattern support_material_spacing support_material_angle support_material_interface_layers support_material_interface_spacing support_material_contact_distance dont_support_bridges notes @@ -864,10 +864,11 @@ sub _update { my $have_support_material = $config->support_material || $config->raft_layers > 0; my $have_support_interface = $config->support_material_interface_layers > 0; $self->get_field($_)->toggle($have_support_material) - for qw(support_material_threshold support_material_pattern + for qw(support_material_threshold support_material_pattern support_material_spacing support_material_angle support_material_interface_layers dont_support_bridges support_material_extrusion_width support_material_contact_distance); + $self->get_field($_)->toggle($have_support_material && $have_support_interface) for qw(support_material_interface_spacing support_material_interface_extruder support_material_interface_speed); diff --git a/lib/Slic3r/Print/SupportMaterial.pm b/lib/Slic3r/Print/SupportMaterial.pm index 34829a2a2e..02b2e5375a 100644 --- a/lib/Slic3r/Print/SupportMaterial.pm +++ b/lib/Slic3r/Print/SupportMaterial.pm @@ -92,7 +92,7 @@ sub contact_area { # if user specified a custom angle threshold, convert it to radians my $threshold_rad; - if ($self->object_config->support_material_threshold) { + if (!$self->object_config->support_material_threshold =~ /%$/) { $threshold_rad = deg2rad($self->object_config->support_material_threshold + 1); # +1 makes the threshold inclusive Slic3r::debugf "Threshold angle = %d°\n", rad2deg($threshold_rad); } @@ -152,7 +152,7 @@ sub contact_area { } else { $diff = diff( [ map $_->p, @{$layerm->slices} ], - offset([ map @$_, @{$lower_layer->slices} ], +$fw*2), + offset([ map @$_, @{$lower_layer->slices} ], +$self->object_config->get_abs_value_over('support_material_threshold', $fw)), ); # collapse very tiny spots diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index aca51e3348..e024393ba2 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -1291,6 +1291,9 @@ PrintConfigDef::PrintConfigDef() def->min = 0; def->default_value = new ConfigOptionFloat(2.5); + + + def = this->add("support_material_speed", coFloat); def->label = "Support material"; def->gui_type = "f_enum_open"; @@ -1303,15 +1306,15 @@ PrintConfigDef::PrintConfigDef() def->enum_labels.push_back("auto"); def->default_value = new ConfigOptionFloat(60); - def = this->add("support_material_threshold", coInt); + def = this->add("support_material_threshold", coFloatOrPercent); def->label = "Overhang threshold"; def->category = "Support material"; - def->tooltip = "Support material will not be generated for overhangs whose slope angle (90° = vertical) is above the given threshold. In other words, this value represent the most horizontal slope (measured from the horizontal plane) that you can print without support material. Set to zero for automatic detection (recommended)."; - def->sidetext = "°"; - def->cli = "support-material-threshold=i"; + def->tooltip = "Support material will not be generated for overhangs whose slope angle (90° = vertical) is above the given threshold. In other words, this value represent the most horizontal slope (measured from the horizontal plane) that you can print without support material. Set to a percentage to automatically detect based on some % of overhanging perimeter width instead (recommended)."; + def->sidetext = "° (or %)"; + def->cli = "support-material-threshold=s"; def->min = 0; - def->max = 90; - def->default_value = new ConfigOptionInt(0); + def->max = 300; + def->default_value = new ConfigOptionFloatOrPercent(60, true); def = this->add("temperature", coInts); def->label = "Other layers"; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index 27c5d4e754..3694819c69 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -161,7 +161,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig ConfigOptionEnum support_material_pattern; ConfigOptionFloat support_material_spacing; ConfigOptionFloat support_material_speed; - ConfigOptionInt support_material_threshold; + ConfigOptionFloatOrPercent support_material_threshold; ConfigOptionFloat xy_size_compensation; PrintObjectConfig(bool initialize = true) : StaticPrintConfig() {