diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index d976e715..9f4cba2b 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -25,7 +25,11 @@ has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}}); sub _build_bridge_flow { my $self = shift; - return Slic3r::Flow::Bridge->new(nozzle_diameter => $self->nozzle_diameter); + + return Slic3r::Flow::Bridge->new( + nozzle_diameter => $self->nozzle_diameter, + bridge_flow_ratio => $self->config->bridge_flow_ratio, + ); } sub _build_e_per_mm3 { diff --git a/lib/Slic3r/Flow.pm b/lib/Slic3r/Flow.pm index b4aaad49..a02f7b34 100644 --- a/lib/Slic3r/Flow.pm +++ b/lib/Slic3r/Flow.pm @@ -90,13 +90,14 @@ use Moo; extends 'Slic3r::Flow'; # layer_height is not required in this case -has '+layer_height' => (is => 'ro', required => 0); +has '+layer_height' => (is => 'ro', required => 0); +has 'bridge_flow_ratio' => (is => 'ro', required => 1); use Slic3r::Geometry qw(PI); sub _build_width { my $self = shift; - return sqrt($Slic3r::Config->bridge_flow_ratio * ($self->nozzle_diameter**2)); + return sqrt($self->bridge_flow_ratio * ($self->nozzle_diameter**2)); } sub _build_spacing { diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 19ea2dce..83566b1f 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -39,9 +39,6 @@ sub BUILD { sub init_config { my $self = shift; - # store config in a handy place - $Slic3r::Config = $self->config; - # legacy with existing config files $self->config->set('first_layer_height', $self->config->layer_height) if !$self->config->first_layer_height; @@ -861,7 +858,7 @@ sub write_gcode { } my $buffer = Slic3r::GCode::CoolingBuffer->new( - config => $Slic3r::Config, + config => $self->config, gcodegen => $gcodegen, ); @@ -903,7 +900,7 @@ sub write_gcode { } my $buffer = Slic3r::GCode::CoolingBuffer->new( - config => $Slic3r::Config, + config => $self->config, gcodegen => $gcodegen, ); foreach my $print_z (sort { $a <=> $b } keys %layers) { diff --git a/t/threads.t b/t/threads.t index 420d58f3..106a68af 100644 --- a/t/threads.t +++ b/t/threads.t @@ -26,10 +26,10 @@ plan tests => 2; { my $thread = threads->create(sub { - # $print can't be inizialized outside the thread because Object->slice will - # modify it by removing meshes and popping layers - my $print = Slic3r::Test::init_print('20mm_cube'); - Slic3r::Test::gcode($print); + { + my $print = Slic3r::Test::init_print('20mm_cube'); + Slic3r::Test::gcode($print); + } Slic3r::thread_cleanup(); return 1; });