diff --git a/src/libslic3r/PlaceholderParser.cpp b/src/libslic3r/PlaceholderParser.cpp index 660f45ee4..c077d6cd7 100644 --- a/src/libslic3r/PlaceholderParser.cpp +++ b/src/libslic3r/PlaceholderParser.cpp @@ -1496,6 +1496,9 @@ bool PlaceholderParser::evaluate_boolean_expression(const std::string &templ, co void PlaceholderParser::append_custom_variables(std::map> name2var_array, int nb_extruders) { + + bool is_array = nb_extruders > 0; + if (!is_array) nb_extruders = 1; std::regex is_a_name("[a-zA-Z_]+"); for (const auto& entry : name2var_array) { if (entry.first.empty()) @@ -1575,17 +1578,27 @@ void PlaceholderParser::append_custom_variables(std::mapset_is_extruder_size(true); - this->set(entry.first, conf); + if (is_array) { + ConfigOptionFloats* conf = new ConfigOptionFloats(double_values); + conf->set_is_extruder_size(true); + this->set(entry.first, conf); + } else { + ConfigOptionFloat* conf = new ConfigOptionFloat(double_values[0]); + this->set(entry.first, conf); + } } else if (!is_not_bool) { std::stringstream log; log << "Parsing BOOL custom variable '" << entry.first << "' : "; for (auto s : bool_values) log << ", " << s; BOOST_LOG_TRIVIAL(trace) << log.str(); - ConfigOptionBools* conf = new ConfigOptionBools(bool_values); - conf->set_is_extruder_size(true); - this->set(entry.first, conf); + if (is_array) { + ConfigOptionBools* conf = new ConfigOptionBools(bool_values); + conf->set_is_extruder_size(true); + this->set(entry.first, conf); + } else { + ConfigOptionBool* conf = new ConfigOptionBool(bool_values[0]); + this->set(entry.first, conf); + } } else { for (std::string& s : string_values) boost::replace_all(s, "\\n", "\n"); @@ -1593,9 +1606,14 @@ void PlaceholderParser::append_custom_variables(std::mapset_is_extruder_size(true); - this->set(entry.first, conf); + if (is_array) { + ConfigOptionStrings* conf = new ConfigOptionStrings(string_values); + conf->set_is_extruder_size(true); + this->set(entry.first, conf); + } else { + ConfigOptionString* conf = new ConfigOptionString(string_values[0]); + this->set(entry.first, conf); + } } } @@ -1623,7 +1641,7 @@ void PlaceholderParser::parse_custom_variables(const ConfigOptionString& custom_ } } - append_custom_variables(name2var_array, 1); + append_custom_variables(name2var_array, 0); } void PlaceholderParser::parse_custom_variables(const ConfigOptionStrings& filament_custom_variables) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index f79542964..caee17188 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -898,7 +898,7 @@ const std::vector& Preset::sla_printer_options() "min_initial_exposure_time", "max_initial_exposure_time", //FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset. "print_host", "printhost_apikey", "printhost_cafile", "printhost_port", - "printer_custom_variables", + "printer_notes", "inherits", "thumbnails", "thumbnails_color",