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.
This commit is contained in:
bubnikv 2019-05-16 15:55:26 +02:00
parent 0eeda8e321
commit df19314645
3 changed files with 6 additions and 3 deletions

View File

@ -57,7 +57,9 @@ 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);
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();

View File

@ -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");

View File

@ -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();