Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Automatic detection of support material threshold angle

  • Loading branch information...
commit 34e047205a43c6ac9e0f47b5416b29cbef8cf9fa 1 parent cbd298b
@alexrj authored
View
3  README.markdown
@@ -189,7 +189,8 @@ The author of the Silk icon set is Mark James.
Support material options:
--support-material Generate support material for overhangs
--support-material-threshold
- Overhang threshold angle (range: 0-90, default: 45)
+ Overhang threshold angle (range: 0-90, set 0 for automatic detection,
+ default: 0)
--support-material-pattern
Pattern to use for support material (default: rectilinear)
--support-material-spacing
View
4 lib/Slic3r/Config.pm
@@ -536,11 +536,11 @@ our $Options = {
},
'support_material_threshold' => {
label => 'Overhang threshold',
- tooltip => 'Support material will not generated for overhangs whose slope angle is above the given threshold.',
+ tooltip => 'Support material will not generated for overhangs whose slope angle is above the given threshold. Set to zero for automatic detection.',
sidetext => '°',
cli => 'support-material-threshold=i',
type => 'i',
- default => 45,
+ default => 0,
},
'support_material_pattern' => {
label => 'Pattern',
View
8 lib/Slic3r/Print/Object.pm
@@ -2,7 +2,7 @@ package Slic3r::Print::Object;
use Moo;
use Slic3r::ExtrusionPath ':roles';
-use Slic3r::Geometry qw(Z scale unscale deg2rad scaled_epsilon);
+use Slic3r::Geometry qw(Z PI scale unscale deg2rad rad2deg scaled_epsilon);
use Slic3r::Geometry::Clipper qw(diff_ex intersection_ex union_ex);
use Slic3r::Surface ':types';
@@ -531,8 +531,12 @@ sub combine_infill {
sub generate_support_material {
my $self = shift;
+ my $threshold_rad = $Slic3r::Config->support_material_threshold
+ ? deg2rad($Slic3r::Config->support_material_threshold + 1) # +1 makes the threshold inclusive
+ : PI/2 - atan2($self->layers->[1]->regions->[0]->perimeter_flow->width/$Slic3r::Config->layer_height/2, 1);
+ Slic3r::debugf "Threshold angle = %d°\n", rad2deg($threshold_rad);
+
my $flow = $self->print->support_material_flow;
- my $threshold_rad = deg2rad($Slic3r::Config->support_material_threshold + 1); # +1 makes the threshold inclusive
my $overhang_width = $threshold_rad == 0 ? undef : scale $Slic3r::Config->layer_height * ((cos $threshold_rad) / (sin $threshold_rad));
my $distance_from_object = 1.5 * $flow->scaled_width;
my $pattern_spacing = ($Slic3r::Config->support_material_spacing > $flow->spacing)
View
3  slic3r.pl
@@ -237,7 +237,8 @@ sub usage {
Support material options:
--support-material Generate support material for overhangs
--support-material-threshold
- Overhang threshold angle (range: 0-90, default: $config->{support_material_threshold})
+ Overhang threshold angle (range: 0-90, set 0 for automatic detection,
+ default: $config->{support_material_threshold})
--support-material-pattern
Pattern to use for support material (default: $config->{support_material_pattern})
--support-material-spacing
Please sign in to comment.
Something went wrong with that request. Please try again.