Skip to content

Commit

Permalink
cleanup commented / deleted code Part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Oekn5w authored and lordofhyphens committed Dec 2, 2019
1 parent 956b7e1 commit c8a9ffc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
6 changes: 2 additions & 4 deletions lib/Slic3r/GUI/Plater.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3398,10 +3398,8 @@ sub make_thumbnail {

my $mesh = $model->objects->[$obj_idx]->raw_mesh;
# Apply x, y rotations and scaling vector in case of reading a 3MF model object.
#my $model_instance = $model->objects->[$obj_idx]->instances->[0];
#$mesh->rotate_x($model_instance->x_rotation);
#$mesh->rotate_y($model_instance->y_rotation);
#$mesh->scale_xyz($model_instance->scaling_vector);
my $model_instance = $model->objects->[$obj_idx]->instances->[0];
$mesh->transform($model_instance->additional_trafo);

if ($mesh->facets_count <= 5000) {
# remove polygons with area <= 1mm
Expand Down
19 changes: 9 additions & 10 deletions lib/Slic3r/GUI/Plater/ObjectPartsPanel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -405,27 +405,26 @@ sub on_btn_lambda {
$params->{"slab_h"},
);
# box sets the base coordinate at 0,0, move to center of plate
#$mesh->translate(
# -$size->x*1.5/2.0,
# -$size->y*1.5/2.0, #**
# 0,
#);
my $trafo = Slic3r::TransformationMatrix->new;
$trafo->set_translation_xyz(-$size->x*1.5/2.0,-$size->y*1.5/2.0,0);
$mesh->transform($trafo);
} else {
return;
}

my $center = $self->{model_object}->bounding_box->center;
if (!$Slic3r::GUI::Settings->{_}{autocenter}) {
#TODO what we really want to do here is just align the
# center of the modifier to the center of the part.
#$mesh->translate($center->x, $center->y, 0);
}

$mesh->repair;
my $new_volume = $self->{model_object}->add_volume(mesh => $mesh);
$new_volume->set_modifier($is_modifier);
$new_volume->set_name($name);

if (!$Slic3r::GUI::Settings->{_}{autocenter}) {
#TODO what we really want to do here is just align the
# center of the modifier to the center of the part.
$new_volume->translate($center->x, $center->y,0);
}

# set a default extruder value, since user can't add it manually
$new_volume->config->set_ifndef('extruder', 0);

Expand Down
8 changes: 0 additions & 8 deletions lib/Slic3r/Model.pm
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,10 @@ sub add_instance {

$new_instance->set_rotation($args{rotation})
if defined $args{rotation};
# $new_instance->set_x_rotation($args{x_rotation})
# if defined $args{x_rotation};
# $new_instance->set_y_rotation($args{y_rotation})
# if defined $args{y_rotation};
$new_instance->set_scaling_factor($args{scaling_factor})
if defined $args{scaling_factor};
# $new_instance->set_scaling_vector($args{scaling_vector})
# if defined $args{scaling_vector};
$new_instance->set_offset($args{offset})
if defined $args{offset};
# $new_instance->set_z_translation($args{z_translation})
# if defined $args{z_translation};

return $new_instance;
}
Expand Down
3 changes: 3 additions & 0 deletions src/GUI/Plater/PlaterObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Slic3r::ExPolygonCollection& PlaterObject::make_thumbnail(std::shared_ptr<Slic3r
auto mesh {model->objects[obj_idx]->raw_mesh()};
auto model_instance {model->objects[obj_idx]->instances[0]};

// Apply any x/y rotations and scaling vector if this came from a 3MF object.
mesh.transform(model_instance->additional_trafo);

if (mesh.facets_count() <= 5000) {
auto area_threshold {scale_(1.0)};
ExPolygons tmp {};
Expand Down

0 comments on commit c8a9ffc

Please sign in to comment.