Fix to autocenter option. (#4156)

* Fix to autocenter option.

Ensure that with autocenter turned off the part is not positioned
in the center of the bed.

* Ensure object is aligned to Z=0 with autocentering off.
This commit is contained in:
Giles Bathgate 2017-10-20 05:35:39 +01:00 committed by Joseph Lenox
parent f302df3fb6
commit 4f2250dc70

View File

@ -1253,12 +1253,20 @@ sub load_model_objects {
push @obj_idx, $#{ $self->{objects} }; push @obj_idx, $#{ $self->{objects} };
if ($model_object->instances_count == 0) { if ($model_object->instances_count == 0) {
# if object has no defined position(s) we need to rearrange everything after loading if ($Slic3r::GUI::Settings->{_}{autocenter}) {
$need_arrange = 1; # if object has no defined position(s) we need to rearrange everything after loading
$need_arrange = 1;
# add a default instance and center object around origin
$o->center_around_origin; # also aligns object to Z = 0 # add a default instance and center object around origin
$o->add_instance(offset => $bed_centerf); $o->center_around_origin; # also aligns object to Z = 0
$o->add_instance(offset => $bed_centerf);
} else {
# if user turned autocentering off, automatic arranging would disappoint them
$need_arrange = 0;
$o->align_to_ground; # aligns object to Z = 0
$o->add_instance();
}
} else { } else {
# if object has defined positions we still need to ensure it's aligned to Z = 0 # if object has defined positions we still need to ensure it's aligned to Z = 0
$o->align_to_ground; $o->align_to_ground;
@ -1278,10 +1286,6 @@ sub load_model_objects {
$self->{print}->add_model_object($o); $self->{print}->add_model_object($o);
} }
# if user turned autocentering off, automatic arranging would disappoint them
if (!$Slic3r::GUI::Settings->{_}{autocenter}) {
$need_arrange = 0;
}
if ($scaled_down) { if ($scaled_down) {
Slic3r::GUI::show_info( Slic3r::GUI::show_info(