Skip to content

Commit

Permalink
Configurable overhang threshold as function of perimeter width (#3752)
Browse files Browse the repository at this point in the history
* Fix automatic overhang threshold

We should be supporting perimeters that are overhung further than half a
perimeter out, rather than two times the perimeter width.

Fixes: #2068

* Made the overhang detection configurable, up to 200 (the original value, which is still the default)

* Set default to 60% as per https://github.com/alexrj/Slic3r/wiki/Support:-Requirements
Removed some less useful enumerations (0-30%)

* Folded in auto_threshold into support threshold as a % value
  • Loading branch information
lordofhyphens authored Mar 11, 2017
1 parent 5d10d4c commit a2fb731
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions lib/Slic3r/GUI/Tab.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/Slic3r/Print/SupportMaterial.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions xs/src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion xs/src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig
ConfigOptionEnum<SupportMaterialPattern> 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() {
Expand Down

0 comments on commit a2fb731

Please sign in to comment.