mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 10:45:54 +08:00
Merge branch 'master' of https://www.github.com/alexrj/slic3r
This commit is contained in:
commit
44a07645ad
@ -289,7 +289,7 @@ sub _load_stl {
|
|||||||
my $input_file = Slic3r::decode_path($dialog->GetPaths);
|
my $input_file = Slic3r::decode_path($dialog->GetPaths);
|
||||||
$dialog->Destroy;
|
$dialog->Destroy;
|
||||||
|
|
||||||
my $model = Slic3r::Model->read_from_file($input_file);
|
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($input_file));
|
||||||
my $mesh = $model->raw_mesh;
|
my $mesh = $model->raw_mesh;
|
||||||
my $expolygons = $mesh->horizontal_projection;
|
my $expolygons = $mesh->horizontal_projection;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ sub quick_slice {
|
|||||||
);
|
);
|
||||||
|
|
||||||
# keep model around
|
# keep model around
|
||||||
my $model = Slic3r::Model->read_from_file($input_file);
|
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($input_file));
|
||||||
|
|
||||||
$sprint->apply_config($config);
|
$sprint->apply_config($config);
|
||||||
$sprint->set_model($model);
|
$sprint->set_model($model);
|
||||||
|
@ -816,7 +816,7 @@ sub add_tin {
|
|||||||
return if $offset < 0;
|
return if $offset < 0;
|
||||||
|
|
||||||
foreach my $input_file (@input_files) {
|
foreach my $input_file (@input_files) {
|
||||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
my $model = eval { Slic3r::Model->read_from_file(Slic3r::encode_path($input_file)) };
|
||||||
Slic3r::GUI::show_error($self, $@) if $@;
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
next if !$model;
|
next if !$model;
|
||||||
|
|
||||||
@ -847,7 +847,7 @@ sub load_file {
|
|||||||
|
|
||||||
local $SIG{__WARN__} = Slic3r::GUI::warning_catcher($self);
|
local $SIG{__WARN__} = Slic3r::GUI::warning_catcher($self);
|
||||||
|
|
||||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
my $model = eval { Slic3r::Model->read_from_file(Slic3r::encode_path($input_file)) };
|
||||||
Slic3r::GUI::show_error($self, $@) if $@;
|
Slic3r::GUI::show_error($self, $@) if $@;
|
||||||
|
|
||||||
my @obj_idx = ();
|
my @obj_idx = ();
|
||||||
|
@ -350,7 +350,7 @@ sub on_btn_load {
|
|||||||
|
|
||||||
my @input_files = wxTheApp->open_model($self);
|
my @input_files = wxTheApp->open_model($self);
|
||||||
foreach my $input_file (@input_files) {
|
foreach my $input_file (@input_files) {
|
||||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
my $model = eval { Slic3r::Model->read_from_file(Slic3r::encode_path($input_file)) };
|
||||||
if ($@) {
|
if ($@) {
|
||||||
Slic3r::GUI::show_error($self, $@);
|
Slic3r::GUI::show_error($self, $@);
|
||||||
next;
|
next;
|
||||||
|
18
slic3r.pl
18
slic3r.pl
@ -74,9 +74,9 @@ my @external_configs = ();
|
|||||||
if ($opt{load}) {
|
if ($opt{load}) {
|
||||||
foreach my $configfile (@{$opt{load}}) {
|
foreach my $configfile (@{$opt{load}}) {
|
||||||
$configfile = Slic3r::decode_path($configfile);
|
$configfile = Slic3r::decode_path($configfile);
|
||||||
if (-e $configfile) {
|
if (-e Slic3r::encode_path($configfile)) {
|
||||||
push @external_configs, Slic3r::Config->load($configfile);
|
push @external_configs, Slic3r::Config->load($configfile);
|
||||||
} elsif (-e "$FindBin::Bin/$configfile") {
|
} elsif (-e Slic3r::encode_path("$FindBin::Bin/$configfile")) {
|
||||||
printf STDERR "Loading $FindBin::Bin/$configfile\n";
|
printf STDERR "Loading $FindBin::Bin/$configfile\n";
|
||||||
push @external_configs, Slic3r::Config->load("$FindBin::Bin/$configfile");
|
push @external_configs, Slic3r::Config->load("$FindBin::Bin/$configfile");
|
||||||
} else {
|
} else {
|
||||||
@ -99,7 +99,7 @@ if ($opt{save}) {
|
|||||||
if (@{$config->get_keys} > 0) {
|
if (@{$config->get_keys} > 0) {
|
||||||
$config->save($opt{save});
|
$config->save($opt{save});
|
||||||
} else {
|
} else {
|
||||||
Slic3r::Config->new_from_defaults->save($opt{save});
|
Slic3r::Config->new_from_defaults->save(Slic3r::decode_path($opt{save}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ if (@ARGV) { # slicing from command line
|
|||||||
if ($opt{cut}) {
|
if ($opt{cut}) {
|
||||||
foreach my $file (@ARGV) {
|
foreach my $file (@ARGV) {
|
||||||
$file = Slic3r::decode_path($file);
|
$file = Slic3r::decode_path($file);
|
||||||
my $model = Slic3r::Model->read_from_file($file);
|
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($file));
|
||||||
$model->add_default_instances;
|
$model->add_default_instances;
|
||||||
my $mesh = $model->mesh;
|
my $mesh = $model->mesh;
|
||||||
$mesh->translate(0, 0, -$mesh->bounding_box->z_min);
|
$mesh->translate(0, 0, -$mesh->bounding_box->z_min);
|
||||||
@ -175,7 +175,7 @@ if (@ARGV) { # slicing from command line
|
|||||||
my ($grid_x, $grid_y) = split /[,x]/, $opt{cut_grid}, 2;
|
my ($grid_x, $grid_y) = split /[,x]/, $opt{cut_grid}, 2;
|
||||||
foreach my $file (@ARGV) {
|
foreach my $file (@ARGV) {
|
||||||
$file = Slic3r::decode_path($file);
|
$file = Slic3r::decode_path($file);
|
||||||
my $model = Slic3r::Model->read_from_file($file);
|
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($file));
|
||||||
$model->add_default_instances;
|
$model->add_default_instances;
|
||||||
my $mesh = $model->mesh;
|
my $mesh = $model->mesh;
|
||||||
my $bb = $mesh->bounding_box;
|
my $bb = $mesh->bounding_box;
|
||||||
@ -217,7 +217,7 @@ if (@ARGV) { # slicing from command line
|
|||||||
if ($opt{split}) {
|
if ($opt{split}) {
|
||||||
foreach my $file (@ARGV) {
|
foreach my $file (@ARGV) {
|
||||||
$file = Slic3r::decode_path($file);
|
$file = Slic3r::decode_path($file);
|
||||||
my $model = Slic3r::Model->read_from_file($file);
|
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($file));
|
||||||
$model->add_default_instances;
|
$model->add_default_instances;
|
||||||
my $mesh = $model->mesh;
|
my $mesh = $model->mesh;
|
||||||
$mesh->repair;
|
$mesh->repair;
|
||||||
@ -236,10 +236,10 @@ if (@ARGV) { # slicing from command line
|
|||||||
$input_file = Slic3r::decode_path($input_file);
|
$input_file = Slic3r::decode_path($input_file);
|
||||||
my $model;
|
my $model;
|
||||||
if ($opt{merge}) {
|
if ($opt{merge}) {
|
||||||
my @models = map Slic3r::Model->read_from_file($_), $input_file, (splice @ARGV, 0);
|
my @models = map Slic3r::Model->read_from_file($_), Slic3r::encode_path($input_file), (splice @ARGV, 0);
|
||||||
$model = Slic3r::Model->merge(@models);
|
$model = Slic3r::Model->merge(@models);
|
||||||
} else {
|
} else {
|
||||||
$model = Slic3r::Model->read_from_file($input_file);
|
$model = Slic3r::Model->read_from_file(Slic3r::encode_path($input_file));
|
||||||
}
|
}
|
||||||
$model->repair;
|
$model->repair;
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ if (@ARGV) { # slicing from command line
|
|||||||
my ($percent, $message) = @_;
|
my ($percent, $message) = @_;
|
||||||
printf "=> %s\n", $message;
|
printf "=> %s\n", $message;
|
||||||
},
|
},
|
||||||
output_file => $opt{output},
|
output_file => Slic3r::decode_path($opt{output}),
|
||||||
);
|
);
|
||||||
|
|
||||||
$sprint->apply_config($config);
|
$sprint->apply_config($config);
|
||||||
|
@ -17,8 +17,6 @@ class MultiPoint
|
|||||||
Points points;
|
Points points;
|
||||||
|
|
||||||
operator Points() const;
|
operator Points() const;
|
||||||
MultiPoint() {};
|
|
||||||
explicit MultiPoint(const Points &_points): points(_points) {};
|
|
||||||
void scale(double factor);
|
void scale(double factor);
|
||||||
void translate(double x, double y);
|
void translate(double x, double y);
|
||||||
void translate(const Point &vector);
|
void translate(const Point &vector);
|
||||||
@ -48,6 +46,11 @@ class MultiPoint
|
|||||||
std::string dump_perl() const;
|
std::string dump_perl() const;
|
||||||
|
|
||||||
static Points _douglas_peucker(const Points &points, const double tolerance);
|
static Points _douglas_peucker(const Points &points, const double tolerance);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
MultiPoint() {};
|
||||||
|
explicit MultiPoint(const Points &_points): points(_points) {};
|
||||||
|
~MultiPoint() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user