Handle non existing STL files gracefully
This commit is contained in:
parent
9b2445f0f5
commit
d1bb69434e
2 changed files with 8 additions and 3 deletions
|
@ -7,8 +7,11 @@ sub read_file {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($file) = @_;
|
my ($file) = @_;
|
||||||
|
|
||||||
|
my $path = Slic3r::encode_path($file);
|
||||||
|
die "Failed to open $file\n" if !-e $path;
|
||||||
|
|
||||||
my $mesh = Slic3r::TriangleMesh->new;
|
my $mesh = Slic3r::TriangleMesh->new;
|
||||||
$mesh->ReadSTLFile(Slic3r::encode_path($file));
|
$mesh->ReadSTLFile($path);
|
||||||
$mesh->repair;
|
$mesh->repair;
|
||||||
|
|
||||||
my $model = Slic3r::Model->new;
|
my $model = Slic3r::Model->new;
|
||||||
|
|
|
@ -382,10 +382,12 @@ sub load_file {
|
||||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||||
Slic3r::GUI::show_error($self, $@) if $@;
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
|
|
||||||
|
if (defined $model) {
|
||||||
$self->load_model_objects(@{$model->objects});
|
$self->load_model_objects(@{$model->objects});
|
||||||
|
$self->statusbar->SetStatusText("Loaded " . basename($input_file));
|
||||||
|
}
|
||||||
|
|
||||||
$process_dialog->Destroy;
|
$process_dialog->Destroy;
|
||||||
$self->statusbar->SetStatusText("Loaded " . basename($input_file));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub load_model_objects {
|
sub load_model_objects {
|
||||||
|
|
Loading…
Add table
Reference in a new issue