Read OBJ files. #324

This commit is contained in:
Alessandro Ranellucci 2012-05-20 11:40:37 +02:00
parent fbe70ac15b
commit 1998801a58
7 changed files with 35 additions and 6 deletions

View file

@ -29,12 +29,16 @@ sub add_object_from_file {
my $mesh = Slic3r::Format::STL->read_file($input_file);
$mesh->check_manifoldness;
$object = $self->add_object_from_mesh($mesh);
} elsif ($input_file =~ /\.obj$/i) {
my $mesh = Slic3r::Format::OBJ->read_file($input_file);
$mesh->check_manifoldness;
$object = $self->add_object_from_mesh($mesh);
} elsif ( $input_file =~ /\.amf(\.xml)?$/i) {
my ($materials, $meshes_by_material) = Slic3r::Format::AMF->read_file($input_file);
$_->check_manifoldness for values %$meshes_by_material;
$object = $self->add_object_from_mesh($meshes_by_material->{_} || +(values %$meshes_by_material)[0]);
} else {
die "Input file must have .stl or .amf(.xml) extension\n";
die "Input file must have .stl, .obj or .amf(.xml) extension\n";
}
$object->input_file($input_file);
return $object;