From 7d81aee62f546cab31fd1ac9d58538b1de43c2eb Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 2 May 2015 21:59:15 +0200 Subject: [PATCH] Added the [scale] placeholder. #2791 --- lib/Slic3r/Print.pm | 5 +++++ xs/xsp/PlaceholderParser.xsp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 2837e0db77..8c94fedb31 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -432,6 +432,11 @@ sub expanded_output_filepath { $self->placeholder_parser->set(input_filename => $filename); $self->placeholder_parser->set(input_filename_base => $filename_base); + # set other variables from model object + $self->placeholder_parser->set_multiple( + scale => [ map $_->model_object->instances->[0]->scaling_factor * 100 . "%", @{$self->objects} ], + ); + if ($path && -d $path) { # if output path is an existing directory, we take that and append # the specified filename format diff --git a/xs/xsp/PlaceholderParser.xsp b/xs/xsp/PlaceholderParser.xsp index 760f3b71f9..b36a471892 100644 --- a/xs/xsp/PlaceholderParser.xsp +++ b/xs/xsp/PlaceholderParser.xsp @@ -14,6 +14,8 @@ void apply_config(DynamicPrintConfig *config) %code%{ THIS->apply_config(*config); %}; void set(std::string key, std::string value); + void set_multiple(std::string key, std::vector values) + %code%{ THIS->set(key, values); %}; void _single_set(std::string k, std::string v) %code%{ THIS->_single[k] = v; %};