1
0
mirror of https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git synced 2026-07-31 11:15:52 +00:00

Refactoring: new Slic3r::Model class to represent files

This commit is contained in:
Alessandro Ranellucci
2012-08-29 16:49:38 +02:00
parent c0322ec703
commit f90520ed06
14 changed files with 255 additions and 88 deletions
+8 -5
View File
@@ -117,7 +117,10 @@ sub read_file {
}
}
return Slic3r::TriangleMesh->new(vertices => $vertices, facets => $facets);
my $model = Slic3r::Model->new;
my $object = $model->add_object(vertices => $vertices);
my $volume = $object->add_volume(facets => $facets);
return $model;
}
sub _read_ascii {
@@ -161,13 +164,13 @@ sub _read_binary {
sub write_file {
my $self = shift;
my ($file, $mesh, $binary) = @_;
my ($file, $model, %params) = @_;
open my $fh, '>', $file;
$binary
? _write_binary($fh, $mesh)
: _write_ascii($fh, $mesh);
$params{binary}
? _write_binary($fh, $model->mesh)
: _write_ascii($fh, $model->mesh);
close $fh;
}