Refactoring. Use Model class for representing the plate in GUI

This commit is contained in:
Alessandro Ranellucci 2013-12-12 20:19:33 +01:00
parent f55e057504
commit 0e8a0ef1ca
19 changed files with 610 additions and 620 deletions

View file

@ -110,19 +110,15 @@ sub add_model_object {
my $bb1 = Slic3r::Geometry::BoundingBox->merge(map $_->bounding_box, values %meshes);
foreach my $mesh (values %meshes) {
# align meshes to object origin before applying transformations
$mesh->translate(@{$bb1->vector_to_origin});
# the order of these transformations must be the same as the one used in plater
# to make the object positioning consistent with the visual preview
# we ignore the per-instance transformations currently and only
# consider the first one
if ($object->instances && @{$object->instances}) {
$mesh->rotate($object->instances->[0]->rotation, $object->center_2D);
$mesh->rotate($object->instances->[0]->rotation, Slic3r::Point->new(0,0));
$mesh->scale($object->instances->[0]->scaling_factor);
}
$mesh->repair; # needed? TODO: try without
}
# we align object also after transformations so that we only work with positive coordinates