diff --git a/lib/Slic3r/Print/Simple.pm b/lib/Slic3r/Print/Simple.pm index 4fe3eb820..fda229e2f 100644 --- a/lib/Slic3r/Print/Simple.pm +++ b/lib/Slic3r/Print/Simple.pm @@ -45,7 +45,6 @@ has 'status_cb' => ( has 'print_center' => ( is => 'rw', - default => sub { Slic3r::Pointf->new(100,100) }, ); has 'dont_arrange' => ( @@ -82,7 +81,15 @@ sub set_model { $model->duplicate($self->duplicate, $self->_print->config->min_object_distance); } $_->translate(0,0,-$_->bounding_box->z_min) for @{$model->objects}; - $model->center_instances_around_point($self->print_center) if (! $self->dont_arrange); + + if (!$self->dont_arrange) { + my $print_center = $self->print_center; + if (!defined $print_center) { + my $polygon = Slic3r::Polygon->new_scale(@{$self->_print->config->bed_shape}); + $print_center = Slic3r::Pointf->new_unscale(@{ $polygon->centroid }); + } + $model->center_instances_around_point($print_center); + } foreach my $model_object (@{$model->objects}) { $self->_print->auto_assign_extruders($model_object); diff --git a/slic3r.pl b/slic3r.pl index ee9e45214..5ae2e22fa 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -253,7 +253,7 @@ if (@ARGV) { # slicing from command line rotate => deg2rad($opt{rotate} // 0), duplicate => $opt{duplicate} // 1, duplicate_grid => $opt{duplicate_grid} // [1,1], - print_center => $opt{print_center} // Slic3r::Pointf->new(100,100), + print_center => $opt{print_center}, dont_arrange => $opt{dont_arrange} // 0, status_cb => sub { my ($percent, $message) = @_;