New --support-material-pattern and --support-material-angle options

This commit is contained in:
Alessandro Ranellucci 2012-06-23 22:43:23 +02:00
parent e72bd56b9d
commit bf1aba3d08
8 changed files with 50 additions and 21 deletions

View File

@ -159,10 +159,16 @@ The author is Alessandro Ranellucci.
the default commands (turn off temperature [M104 S0], the default commands (turn off temperature [M104 S0],
home X axis [G28 X], disable motors [M84]). home X axis [G28 X], disable motors [M84]).
--layer-gcode Load layer-change G-code from the supplied file (default: nothing). --layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--support-material Generate support material for overhangs
--extra-perimeters Add more perimeters when needed (default: yes) --extra-perimeters Add more perimeters when needed (default: yes)
--randomize-start Randomize starting point across layers (default: yes) --randomize-start Randomize starting point across layers (default: yes)
Support material options:
--support-material Generate support material for overhangs
--support-material-pattern
Pattern to use for support material (default: rectilinear)
--support-material-angle
Support material angle in degrees (range: 0-90, default: 0)
Retraction options: Retraction options:
--retract-length Length of retraction in mm when pausing extrusion --retract-length Length of retraction in mm when pausing extrusion
(default: 1) (default: 1)

View File

@ -123,6 +123,8 @@ our $fill_angle = 45;
our $extra_perimeters = 1; our $extra_perimeters = 1;
our $randomize_start = 1; our $randomize_start = 1;
our $support_material = 0; our $support_material = 0;
our $support_material_pattern = 'rectilinear';
our $support_material_angle = 0;
our $support_material_tool = 0; our $support_material_tool = 0;
our $start_gcode = "G28 ; home all axes"; our $start_gcode = "G28 ; home all axes";
our $end_gcode = <<"END"; our $end_gcode = <<"END";

View File

@ -16,8 +16,8 @@ our $Options = {
cli => 'notes=s', cli => 'notes=s',
type => 's', type => 's',
multiline => 1, multiline => 1,
width => 220, width => 400,
height => 130, height => 100,
serialize => sub { join '\n', split /\R/, $_[0] }, serialize => sub { join '\n', split /\R/, $_[0] },
deserialize => sub { join "\n", split /\\n/, $_[0] }, deserialize => sub { join "\n", split /\\n/, $_[0] },
}, },
@ -284,8 +284,20 @@ our $Options = {
cli => 'support-material!', cli => 'support-material!',
type => 'bool', type => 'bool',
}, },
'support_material_pattern' => {
label => 'Pattern',
cli => 'support-material-pattern=s',
type => 'select',
values => [qw(rectilinear honeycomb)],
labels => [qw(rectilinear honeycomb)],
},
'support_material_angle' => {
label => 'Angle (°)',
cli => 'support-material-angle=i',
type => 'i',
},
'support_material_tool' => { 'support_material_tool' => {
label => 'Tool used to extrude support material', label => 'Extruder',
cli => 'support-material-tool=i', cli => 'support-material-tool=i',
type => 'select', type => 'select',
values => [0,1], values => [0,1],

View File

@ -5,6 +5,7 @@ use Moo;
has 'print' => (is => 'rw'); has 'print' => (is => 'rw');
has 'layer' => (is => 'rw'); has 'layer' => (is => 'rw');
has 'max_print_dimension' => (is => 'rw'); has 'max_print_dimension' => (is => 'rw');
has 'angle' => (is => 'rw', default => sub { $Slic3r::fill_angle });
use constant PI => 4 * atan2(1, 1); use constant PI => 4 * atan2(1, 1);
@ -16,7 +17,7 @@ sub infill_direction {
# set infill angle # set infill angle
my (@rotate, @shift); my (@rotate, @shift);
$rotate[0] = Slic3r::Geometry::deg2rad($Slic3r::fill_angle); $rotate[0] = Slic3r::Geometry::deg2rad($self->angle);
$rotate[1] = [ $self->max_print_dimension * sqrt(2) / 2, $self->max_print_dimension * sqrt(2) / 2 ]; $rotate[1] = [ $self->max_print_dimension * sqrt(2) / 2, $self->max_print_dimension * sqrt(2) / 2 ];
@shift = @{$rotate[1]}; @shift = @{$rotate[1]};
@ -24,7 +25,7 @@ sub infill_direction {
# alternate fill direction # alternate fill direction
my $layer_num = $self->layer->id / $surface->depth_layers; my $layer_num = $self->layer->id / $surface->depth_layers;
my $angle = $self->angles->[$layer_num % @{$self->angles}]; my $angle = $self->angles->[$layer_num % @{$self->angles}];
$rotate[0] = Slic3r::Geometry::deg2rad($Slic3r::fill_angle) + $angle if $angle; $rotate[0] = Slic3r::Geometry::deg2rad($self->angle) + $angle if $angle;
} }
# use bridge angle # use bridge angle

View File

@ -69,7 +69,7 @@ sub fill_surface {
($_[X] >= ($distance_between_lines - $line_oscillation) - $tolerance) && ($_[X] <= ($distance_between_lines + $line_oscillation) + $tolerance) ($_[X] >= ($distance_between_lines - $line_oscillation) - $tolerance) && ($_[X] <= ($distance_between_lines + $line_oscillation) + $tolerance)
&& $_[Y] <= $diagonal_distance && $_[Y] <= $diagonal_distance
} }
: sub { abs($_[X]) - $distance_between_lines <= $tolerance && $_[Y] <= $diagonal_distance }; : sub { abs($_[X] - $distance_between_lines) <= $tolerance && $_[Y] <= $diagonal_distance };
foreach my $path ($collection->shortest_path) { foreach my $path ($collection->shortest_path) {
if (@paths) { if (@paths) {

View File

@ -44,7 +44,7 @@ sub new {
}, },
print => { print => {
title => 'Print settings', title => 'Print settings',
options => [qw(perimeters solid_layers fill_density fill_angle fill_pattern solid_fill_pattern randomize_start support_material)], options => [qw(perimeters solid_layers fill_density fill_angle fill_pattern solid_fill_pattern randomize_start)],
}, },
retract => { retract => {
title => 'Retraction', title => 'Retraction',
@ -53,7 +53,7 @@ sub new {
cooling => { cooling => {
title => 'Cooling', title => 'Cooling',
options => [qw(cooling min_fan_speed max_fan_speed bridge_fan_speed fan_below_layer_time slowdown_below_layer_time min_print_speed disable_fan_first_layers fan_always_on)], options => [qw(cooling min_fan_speed max_fan_speed bridge_fan_speed fan_below_layer_time slowdown_below_layer_time min_print_speed disable_fan_first_layers fan_always_on)],
label_width => 300, label_width => 450,
}, },
skirt => { skirt => {
title => 'Skirt', title => 'Skirt',
@ -78,12 +78,16 @@ sub new {
}, },
other => { other => {
title => 'Other', title => 'Other',
options => [ ($Slic3r::have_threads ? qw(threads) : ()), qw(extra_perimeters support_material_tool) ], options => [ ($Slic3r::have_threads ? qw(threads) : ()), qw(extra_perimeters) ],
}, },
notes => { notes => {
title => 'Notes', title => 'Notes',
options => [qw(notes)], options => [qw(notes)],
}, },
support_material => {
title => 'Support material',
options => [qw(support_material support_material_tool)],
},
); );
$self->{panels} = \%panels; $self->{panels} = \%panels;
@ -108,8 +112,8 @@ sub new {
}; };
my @tabs = ( my @tabs = (
$make_tab->([qw(accuracy skirt retract)], [qw(print notes)]), $make_tab->([qw(accuracy skirt support_material)], [qw(print retract)]),
$make_tab->([qw(cooling)]), $make_tab->([qw(cooling notes)]),
$make_tab->([qw(printer filament)], [qw(print_speed speed)]), $make_tab->([qw(printer filament)], [qw(print_speed speed)]),
$make_tab->([qw(gcode)]), $make_tab->([qw(gcode)]),
$make_tab->([qw(extrusion sequential_printing)], [qw(output other)]), $make_tab->([qw(extrusion sequential_printing)], [qw(output other)]),

View File

@ -545,20 +545,18 @@ sub generate_support_material {
# generate paths for the pattern that we're going to use # generate paths for the pattern that we're going to use
Slic3r::debugf "Generating patterns\n"; Slic3r::debugf "Generating patterns\n";
my $support_patterns = []; my $support_patterns = []; # in case we want cross-hatching
{ {
my @support_material_areas = @{union_ex([ map @$_, @unsupported_expolygons ])}; my @support_material_areas = @{union_ex([ map @$_, @unsupported_expolygons ])};
my $fill = Slic3r::Fill->new(print => $params{print}); my $fill = Slic3r::Fill->new(print => $params{print});
foreach my $layer (map $self->layers->[$_], 0,1,2) { # ugly hack my $filler = $fill->filler($Slic3r::support_material_pattern);
$fill->filler('honeycomb')->layer($layer); $filler->angle($Slic3r::support_material_angle);
{
my @patterns = (); my @patterns = ();
foreach my $expolygon (@support_material_areas) { foreach my $expolygon (@support_material_areas) {
my @paths = $fill->filler('honeycomb')->fill_surface( my @paths = $filler->fill_surface(
Slic3r::Surface->new( Slic3r::Surface->new(expolygon => $expolygon),
expolygon => $expolygon,
#bridge_angle => $Slic3r::fill_angle + 45 + $angle,
),
density => 0.20, density => 0.20,
flow_spacing => $Slic3r::flow->spacing, flow_spacing => $Slic3r::flow->spacing,
); );

View File

@ -204,10 +204,16 @@ $j
the default commands (turn off temperature [M104 S0], the default commands (turn off temperature [M104 S0],
home X axis [G28 X], disable motors [M84]). home X axis [G28 X], disable motors [M84]).
--layer-gcode Load layer-change G-code from the supplied file (default: nothing). --layer-gcode Load layer-change G-code from the supplied file (default: nothing).
--support-material Generate support material for overhangs
--extra-perimeters Add more perimeters when needed (default: yes) --extra-perimeters Add more perimeters when needed (default: yes)
--randomize-start Randomize starting point across layers (default: yes) --randomize-start Randomize starting point across layers (default: yes)
Support material options:
--support-material Generate support material for overhangs
--support-material-pattern
Pattern to use for support material (default: $Slic3r::support_material_pattern)
--support-material-angle
Support material angle in degrees (range: 0-90, default: $Slic3r::support_material_angle)
Retraction options: Retraction options:
--retract-length Length of retraction in mm when pausing extrusion --retract-length Length of retraction in mm when pausing extrusion
(default: $Slic3r::retract_length) (default: $Slic3r::retract_length)