From 757515ba170b2f741528b94428ebf34b04e6afc0 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 12 Sep 2012 15:29:44 +0200 Subject: [PATCH] New [print_preset], [filament_preset] and [printer_preset] variables. #675 --- lib/Slic3r/GUI/Plater.pm | 2 ++ lib/Slic3r/Print.pm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 9488fc4bc..4996e68ec 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -475,6 +475,8 @@ sub export_gcode { # set this before spawning the thread because ->config needs GetParent and it's not available there $self->{print}->config($self->skeinpanel->config); + $self->{print}->extra_variables->{"${_}_preset"} = $self->skeinpanel->{options_tabs}{$_}->current_preset->{name} + for qw(print filament printer); # select output file $self->{output_file} = $main::opt{output}; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index d0173a8a4..868b75846 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -11,6 +11,7 @@ use Slic3r::Geometry::Clipper qw(diff_ex union_ex intersection_ex offset JT_ROUN use Time::HiRes qw(gettimeofday tv_interval); has 'config' => (is => 'rw', default => sub { Slic3r::Config->new_from_defaults }, trigger => 1); +has 'extra_variables' => (is => 'rw', default => sub {{}}); has 'objects' => (is => 'rw', default => sub {[]}); has 'copies' => (is => 'rw', default => sub {[]}); # obj_idx => [copies...] has 'total_extrusion_length' => (is => 'rw'); @@ -808,6 +809,7 @@ sub expanded_output_filepath { return $Slic3r::Config->replace_options($path, { input_filename => $input_filename, input_filename_base => $input_filename_base, + %{ $self->extra_variables }, }); }