Fix STL export. #1448

This commit is contained in:
Alessandro Ranellucci 2013-09-19 12:25:00 +02:00
parent 213f832e75
commit afdb490cf1
2 changed files with 9 additions and 8 deletions

View File

@ -568,7 +568,8 @@ sub split_object {
my $mesh = $model_object->mesh;
$mesh->align_to_origin;
my @new_meshes = $mesh->split_mesh;
$mesh->repair;
my @new_meshes = @{$mesh->split};
if (@new_meshes == 1) {
Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be split because it already contains a single part.");
return;
@ -583,9 +584,10 @@ sub split_object {
my $new_model = Slic3r::Model->new;
foreach my $mesh (@new_meshes) {
$mesh->repair;
my $bb = $mesh->bounding_box;
my $model_object = $new_model->add_object(vertices => $mesh->vertices);
$model_object->add_volume(facets => $mesh->facets);
my $model_object = $new_model->add_object;
$model_object->add_volume(mesh => $mesh);
my $object = Slic3r::GUI::Plater::Object->new(
name => basename($current_object->input_file),
input_file => $current_object->input_file,

View File

@ -216,10 +216,10 @@ sub mesh {
foreach my $instance (@instances) {
my $mesh = $object->mesh->clone;
if ($instance) {
$mesh->rotate($instance->rotation);
$mesh->rotate($instance->rotation, Slic3r::Point->new(0,0));
$mesh->scale($instance->scaling_factor);
$mesh->align_to_origin;
$mesh->move(@{$instance->offset});
$mesh->translate(@{$instance->offset}, 0);
}
push @meshes, $mesh;
}
@ -246,15 +246,14 @@ sub split_meshes {
}
my $volume = $object->volumes->[0];
foreach my $mesh ($volume->mesh->split_mesh) {
foreach my $mesh (@{$volume->mesh->split}) {
my $new_object = $self->add_object(
input_file => $object->input_file,
config => $object->config,
layer_height_ranges => $object->layer_height_ranges,
);
$new_object->add_volume(
vertices => $mesh->vertices,
facets => $mesh->facets,
mesh => $mesh,
material_id => $volume->material_id,
);