Automatic detection of support material threshold angle

This commit is contained in:
Alessandro Ranellucci 2013-01-02 19:40:48 +01:00
parent cbd298bc36
commit 34e047205a
4 changed files with 12 additions and 6 deletions

View File

@ -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 File

@ -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 File

@ -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 File

@ -237,7 +237,8 @@ $j
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