diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 9488fc4b..4996e68e 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 d0173a8a..868b7584 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 }, }); }