From a0fd774985de290fa740cc709600a70faf38382a Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 16 May 2019 15:55:26 +0200 Subject: [PATCH] Changed the default of output_filename_format to "[input_filename_base].gcode" for FDM, and "[input_filename_base].sl1" for the SLA technology. This improves the situation of "Filename creation with variables broken" https://github.com/prusa3d/PrusaSlicer/issues/1918 where anything after the last dot in the file name is considered as an extension, therefore the .gcode resp. .sl1 extension is not added. Now the user gets the output_filename_format filled in with the correct extension. Also now if the output_filename_format is empty, the output name is generated anyway. --- src/libslic3r/PrintBase.cpp | 6 ++++-- src/libslic3r/PrintConfig.cpp | 2 +- src/slic3r/GUI/PresetBundle.cpp | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp index 3fe9a2b4d3b..412aae338a5 100644 --- a/src/libslic3r/PrintBase.cpp +++ b/src/libslic3r/PrintBase.cpp @@ -57,8 +57,10 @@ std::string PrintBase::output_filename(const std::string &format, const std::str PlaceholderParser::update_timestamp(cfg); this->update_object_placeholders(cfg); try { - boost::filesystem::path filename = this->placeholder_parser().process(format, 0, &cfg); - if (filename.extension().empty()) + boost::filesystem::path filename = format.empty() ? + cfg.opt_string("input_filename_base") + "." + default_ext : + this->placeholder_parser().process(format, 0, &cfg); + if (filename.extension().empty()) filename = boost::filesystem::change_extension(filename, default_ext); return filename.string(); } catch (std::runtime_error &err) { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 8140177b3cb..3c8849d78be 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1323,7 +1323,7 @@ void PrintConfigDef::init_fff_params() "[input_filename_base]."); def->full_width = true; def->mode = comExpert; - def->set_default_value(new ConfigOptionString("[input_filename_base]")); + def->set_default_value(new ConfigOptionString("[input_filename_base].gcode")); def = this->add("overhangs", coBool); def->label = L("Detect bridging perimeters"); diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index e92311cfe8d..f6cc73b6f8d 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -78,6 +78,7 @@ PresetBundle::PresetBundle() : this->sla_materials.default_preset().inherits(); this->sla_prints.default_preset().config.optptr("sla_print_settings_id", true); + this->sla_prints.default_preset().config.opt_string("output_filename_format", true) = "[input_filename_base].sl1"; this->sla_prints.default_preset().compatible_printers_condition(); this->sla_prints.default_preset().inherits();