mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-06-30 16:05:12 +08:00
Enhanced fix of #1229 - perl part
This commit is contained in:
parent
78e7bb0427
commit
cce5f3203b
@ -407,17 +407,24 @@ sub on_btn_load {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach my $object (@{$model->objects}) {
|
foreach my $object (@{$model->objects}) {
|
||||||
$object->center_around_origin;
|
my $delta_x = 0.0;
|
||||||
|
my $delta_y = 0.0;
|
||||||
|
my $delta_z = 0.0;
|
||||||
|
if (($self->{model_object}->origin_translation->x != 0.0) || ($self->{model_object}->origin_translation->y != 0.0) || ($self->{model_object}->origin_translation->z != 0.0)) {
|
||||||
|
$object->center_around_origin;
|
||||||
|
$delta_x = $self->{model_object}->origin_translation->x - $object->origin_translation->x;
|
||||||
|
$delta_y = $self->{model_object}->origin_translation->y - $object->origin_translation->y;
|
||||||
|
$delta_z = $self->{model_object}->origin_translation->z - $object->origin_translation->z;
|
||||||
|
}
|
||||||
foreach my $volume (@{$object->volumes}) {
|
foreach my $volume (@{$object->volumes}) {
|
||||||
my $new_volume = $self->{model_object}->add_volume($volume);
|
my $new_volume = $self->{model_object}->add_volume($volume);
|
||||||
$new_volume->set_modifier($is_modifier);
|
$new_volume->set_modifier($is_modifier);
|
||||||
$new_volume->set_name(basename($input_file));
|
$new_volume->set_name(basename($input_file));
|
||||||
|
|
||||||
# apply the same translation we applied to the object
|
# apply the same translation we applied to the object
|
||||||
my $delta_x = $self->{model_object}->origin_translation->x - $object->origin_translation->x;
|
if (($delta_x != 0.0) || ($delta_y != 0.0) || ($delta_z != 0.0)) {
|
||||||
my $delta_y = $self->{model_object}->origin_translation->y - $object->origin_translation->y;
|
$new_volume->mesh->translate($delta_x, $delta_y, $delta_z);
|
||||||
my $delta_z = $self->{model_object}->origin_translation->z - $object->origin_translation->z;
|
}
|
||||||
$new_volume->mesh->translate($delta_x, $delta_y, $delta_z);
|
|
||||||
|
|
||||||
# set a default extruder value, since user can't add it manually
|
# set a default extruder value, since user can't add it manually
|
||||||
$new_volume->config->set_ifndef('extruder', 0);
|
$new_volume->config->set_ifndef('extruder', 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user