mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-04 22:10:41 +08:00
If --print-center is not supplied, center print instead of the centroid of the supplied bed_shape instead of defaulting to 100,100. #2725
This commit is contained in:
parent
af46db320f
commit
a29a954d78
@ -45,7 +45,6 @@ has 'status_cb' => (
|
|||||||
|
|
||||||
has 'print_center' => (
|
has 'print_center' => (
|
||||||
is => 'rw',
|
is => 'rw',
|
||||||
default => sub { Slic3r::Pointf->new(100,100) },
|
|
||||||
);
|
);
|
||||||
|
|
||||||
has 'dont_arrange' => (
|
has 'dont_arrange' => (
|
||||||
@ -82,7 +81,15 @@ sub set_model {
|
|||||||
$model->duplicate($self->duplicate, $self->_print->config->min_object_distance);
|
$model->duplicate($self->duplicate, $self->_print->config->min_object_distance);
|
||||||
}
|
}
|
||||||
$_->translate(0,0,-$_->bounding_box->z_min) for @{$model->objects};
|
$_->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}) {
|
foreach my $model_object (@{$model->objects}) {
|
||||||
$self->_print->auto_assign_extruders($model_object);
|
$self->_print->auto_assign_extruders($model_object);
|
||||||
|
@ -253,7 +253,7 @@ if (@ARGV) { # slicing from command line
|
|||||||
rotate => deg2rad($opt{rotate} // 0),
|
rotate => deg2rad($opt{rotate} // 0),
|
||||||
duplicate => $opt{duplicate} // 1,
|
duplicate => $opt{duplicate} // 1,
|
||||||
duplicate_grid => $opt{duplicate_grid} // [1,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,
|
dont_arrange => $opt{dont_arrange} // 0,
|
||||||
status_cb => sub {
|
status_cb => sub {
|
||||||
my ($percent, $message) = @_;
|
my ($percent, $message) = @_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user