From 6eb1fa36edaaafe7acea0e89ed39b8e4ec60a624 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 14 Feb 2015 12:47:33 +0100 Subject: [PATCH] Bugfix: bridge speed was still used for first object layer above raft when support_material_contact_distance == 0. Includes regression tests. #2656 --- lib/Slic3r/Print/Object.pm | 2 +- t/support.t | 42 +++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index dd60a9ec6..4116e4b20 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -650,7 +650,7 @@ sub detect_surfaces_type { # if we have raft layers, consider bottom layer as a bridge # just like any other bottom surface lying on the void - if ($self->config->raft_layers > 0) { + if ($self->config->raft_layers > 0 && $self->config->support_material_contact_distance > 0) { $_->surface_type(S_TYPE_BOTTOMBRIDGE) for @bottom; } else { $_->surface_type(S_TYPE_BOTTOM) for @bottom; diff --git a/t/support.t b/t/support.t index 54d5ef700..9cc38b2b1 100644 --- a/t/support.t +++ b/t/support.t @@ -1,4 +1,4 @@ -use Test::More tests => 20; +use Test::More tests => 24; use strict; use warnings; @@ -180,4 +180,44 @@ use Slic3r::Test; $test->(70); } +TTT: { + my $config = Slic3r::Config->new_from_defaults; + $config->set('brim_width', 0); + $config->set('skirts', 0); + $config->set('support_material', 1); + $config->set('top_solid_layers', 0); # so that we don't have the internal bridge over infill + $config->set('bridge_speed', 99); + $config->set('cooling', 0); + $config->set('first_layer_speed', '100%'); + + my $test = sub { + my $print = Slic3r::Test::init_print('overhang', config => $config); + + my $has_bridge_speed = 0; + Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub { + my ($self, $cmd, $args, $info) = @_; + + if ($info->{extruding}) { + if (($args->{F} // $self->F) == $config->bridge_speed*60) { + $has_bridge_speed = 1; + } + } + }); + return $has_bridge_speed; + }; + + $config->set('support_material_contact_distance', 0.2); + ok $test->(), 'bridge speed is used when support_material_contact_distance > 0'; + + $config->set('support_material_contact_distance', 0); + ok !$test->(), 'bridge speed is not used when support_material_contact_distance == 0'; + + $config->set('raft_layers', 5); + $config->set('support_material_contact_distance', 0.2); + ok $test->(), 'bridge speed is used when raft_layers > 0 and support_material_contact_distance > 0'; + + $config->set('support_material_contact_distance', 0); + ok !$test->(), 'bridge speed is not used when raft_layers > 0 and support_material_contact_distance == 0'; +} + __END__