Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-02-26 23:54:42 +0300
committerbubnikv <bubnikv@gmail.com>2017-02-26 23:54:42 +0300
commitb7aeeb968b4fc6d1725816b264e1238df9d0a17a (patch)
tree08d0f09ea52f0095ec74e5a5d93ee7678bb6a9ea
parent121b3c31d2eb4c882d7798d118ccd68573f8fdb9 (diff)
Using the C++ file loaders.
-rw-r--r--lib/Slic3r/Model.pm8
-rw-r--r--utils/dump-stl.pl3
-rwxr-xr-xutils/split_stl.pl2
-rwxr-xr-xutils/stl-to-amf.pl2
4 files changed, 9 insertions, 6 deletions
diff --git a/lib/Slic3r/Model.pm b/lib/Slic3r/Model.pm
index 39daa753f..466303222 100644
--- a/lib/Slic3r/Model.pm
+++ b/lib/Slic3r/Model.pm
@@ -1,6 +1,7 @@
# extends C++ class Slic3r::Model
package Slic3r::Model;
+use File::Basename qw(basename);
use List::Util qw(first max any);
use Slic3r::Geometry qw(X Y Z move_points);
@@ -8,9 +9,10 @@ sub read_from_file {
my $class = shift;
my ($input_file) = @_;
- my $model = $input_file =~ /\.stl$/i ? Slic3r::Format::STL->read_file($input_file)
- : $input_file =~ /\.obj$/i ? Slic3r::Format::OBJ->read_file($input_file)
- : $input_file =~ /\.amf(\.xml)?$/i ? Slic3r::Format::AMF->read_file($input_file)
+ my $model = $input_file =~ /\.stl$/i ? Slic3r::Model->load_stl(Slic3r::encode_path($input_file), basename($input_file))
+ : $input_file =~ /\.obj$/i ? Slic3r::Model->load_obj(Slic3r::encode_path($input_file), basename($input_file))
+ : $input_file =~ /\.amf(\.xml)?$/i ? Slic3r::Model->load_amf(Slic3r::encode_path($input_file))
+ : $input_file =~ /\.prus$/i ? Slic3r::Model->load_prus(Slic3r::encode_path($input_file))
: die "Input file must have .stl, .obj or .amf(.xml) extension\n";
die "The supplied file couldn't be read because it's empty.\n"
diff --git a/utils/dump-stl.pl b/utils/dump-stl.pl
index 08b4d750a..f96e3f5bb 100644
--- a/utils/dump-stl.pl
+++ b/utils/dump-stl.pl
@@ -12,12 +12,13 @@ BEGIN {
use Slic3r;
use Slic3r::Test;
+use File::Basename qw(basename);
$|++;
$ARGV[0] or usage(1);
if (-e $ARGV[0]) {
- my $model = Slic3r::Format::STL->read_file($ARGV[0]);
+ my $model = Slic3r::Model->load_stl(Slic3r::encode_path($ARGV[0]), basename($ARGV[0]));
$model->objects->[0]->add_instance(offset => Slic3r::Pointf->new(0,0));
my $mesh = $model->mesh;
$mesh->repair;
diff --git a/utils/split_stl.pl b/utils/split_stl.pl
index 8e7d957a4..23fc91b26 100755
--- a/utils/split_stl.pl
+++ b/utils/split_stl.pl
@@ -25,7 +25,7 @@ my %opt = ();
}
{
- my $model = Slic3r::Format::STL->read_file($ARGV[0]);
+ my $model = Slic3r::Model->load_stl(Slic3r::encode_path($ARGV[0]), basename($ARGV[0]));
my $basename = $ARGV[0];
$basename =~ s/\.stl$//i;
diff --git a/utils/stl-to-amf.pl b/utils/stl-to-amf.pl
index e1adec7ce..525dcb52a 100755
--- a/utils/stl-to-amf.pl
+++ b/utils/stl-to-amf.pl
@@ -25,7 +25,7 @@ my %opt = ();
}
{
- my @models = map Slic3r::Format::STL->read_file($_), @ARGV;
+ my @models = map Slic3r::Model->load_stl(Slic3r::encode_path($_), basename($_)), @ARGV;
my $output_file = $ARGV[0];
$output_file =~ s/\.stl$/.amf.xml/i;