From 41df50cc17f2e02d0e2251051616656840caa407 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 20 Nov 2023 18:00:08 +0100 Subject: [PATCH 1/4] Make sure that the certificate is erased if disabled. supermerill/superslicer#3962 --- src/slic3r/GUI/PhysicalPrinterDialog.cpp | 5 +++++ src/slic3r/Utils/OctoPrint.cpp | 25 +++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 951c4a9c16b..ea9cf0afcb1 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -324,6 +324,11 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr m_optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { if(opt_key == "printhost_client_cert_enabled") this->m_show_cert_fields = boost::any_cast(value); + if (!this->m_show_cert_fields && !m_config->opt_string("printhost_client_cert").empty()) { + change_opt_value(*m_config, "printhost_client_cert", std::string("")); + //change_opt_value(*m_config, "printhost_client_cert_password", ""); + m_config->set_deserialize_strict("printhost_client_cert_password", ""); + } if (opt_key == "host_type" || opt_key == "printhost_authorization_type" || opt_key == "printhost_client_cert_enabled") this->update(); if (opt_key == "print_host") diff --git a/src/slic3r/Utils/OctoPrint.cpp b/src/slic3r/Utils/OctoPrint.cpp index cbd0da87e6e..c02df567edc 100644 --- a/src/slic3r/Utils/OctoPrint.cpp +++ b/src/slic3r/Utils/OctoPrint.cpp @@ -103,7 +103,9 @@ OctoPrint::OctoPrint(DynamicPrintConfig *config) : m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke")) {} -const char* OctoPrint::get_name() const { return "OctoPrint"; } + +constexpr char OctoprintName[] = "OctoPrint"; +const char * OctoPrint::get_name() const { return OctoprintName; } bool OctoPrint::test(wxString &msg) const { @@ -171,13 +173,22 @@ bool OctoPrint::test(wxString &msg) const return res; } -wxString OctoPrint::get_test_failed_msg (wxString &msg) const +wxString OctoPrint::get_test_failed_msg(wxString &msg) const { - return GUI::from_u8((boost::format("%s: %s\n\n%s") - % (boost::format(_u8L("Could not connect to %s")) % get_name()) - % std::string(msg.ToUTF8()) - % _u8L("Note: OctoPrint version at least 1.1.0 is required.") - ).str()); + if (get_name() == OctoprintName) { + return GUI::from_u8( + (boost::format("%s: %s\n\n%s") % + (boost::format(_u8L("Could not connect to %s")) % get_name()) % + std::string(msg.ToUTF8()) % + _u8L("Note: OctoPrint version at least 1.1.0 is required.")) + .str()); + } else { + return GUI::from_u8( + (boost::format("%s: %s") % + (boost::format(_u8L("Could not connect to %s")) % get_name()) % + std::string(msg.ToUTF8())) + .str()); + } } bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const From 98688a4007e71cca9a151594a53ecb4f7adfcb15 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 20 Nov 2023 19:04:33 +0100 Subject: [PATCH 2/4] fix current_position custom gcode variable add current_object position for the position of the current object supermerill/SuperSlicer#3958 thanks to @dumitrugrl --- src/libslic3r/GCode.cpp | 16 ++++++++++------ src/libslic3r/GCodeWriter.cpp | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index da610ef95b0..401a34cab44 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -222,9 +222,9 @@ std::string Wipe::wipe(GCode& gcodegen, bool toolchange) wipe_path.clip_end(wipe_path.length() - wipe_dist); // subdivide the retraction in segments - if (!wipe_path.empty()) { - // add tag for processor - gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Start) + "\n"; + if (!wipe_path.empty()) { + // add tag for processor + gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Start) + "\n"; for (const Line& line : wipe_path.lines()) { double segment_length = line.length(); /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one @@ -239,8 +239,8 @@ std::string Wipe::wipe(GCode& gcodegen, bool toolchange) "wipe and retract" ); } - // add tag for processor - gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_End) + "\n"; + // add tag for processor + gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_End) + "\n"; gcodegen.set_last_pos(wipe_path.points.back()); } @@ -2333,7 +2333,11 @@ std::string GCode::placeholder_parser_process(const std::string &name, const std func_add_colour("filament_colour_int", config().filament_colour.values[current_extruder_id]); func_add_colour("extruder_colour_int", config().extruder_colour.values[current_extruder_id]); } - default_config.set_key_value("current_position", new ConfigOptionFloats({ unscaled(m_last_pos.x()), unscaled(m_last_pos.y()) })); + + // should be the same as Vec2d gcode_pos = point_to_gcode(m_last_pos); + Vec3d gcode_pos = this->writer().get_position(); + default_config.set_key_value("current_position", new ConfigOptionFloats( {gcode_pos.x(), gcode_pos.y(), gcode_pos.z()} )); + default_config.set_key_value("current_object_position", new ConfigOptionFloats( {m_origin.x(), m_origin.y()} )); std::string gcode = m_placeholder_parser.process(templ, current_extruder_id, &default_config, &m_placeholder_parser_context); if (!gcode.empty() && (m_config.gcode_comments || m_config.fan_speedup_time.value != 0 || m_config.fan_kickstart.value != 0 )) { diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index c6f6a9a8d8b..dfcdec7299f 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -98,7 +98,7 @@ uint16_t GCodeWriter::first_mill() const { } else return m_millers.front().id(); } bool GCodeWriter::tool_is_extruder() const { - return m_tool->id() < first_mill(); + return m_tool && m_tool->id() < first_mill(); } const Tool* GCodeWriter::get_tool(uint16_t id) const{ for (const Extruder& e : m_extruders) From b35930cff9f11306e3837316d1a145de2773252e Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 20 Nov 2023 20:29:53 +0100 Subject: [PATCH 3/4] fix bad branch for logging pattern write error into .3mf from a5e755f --- src/libslic3r/Format/3mf.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index 54f1a21238f..dcc5464c0a6 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -3160,7 +3160,7 @@ namespace Slic3r { } else { for (const std::string& key : obj->config.keys()) { std::string value = obj->config.opt_serialize(key); - if (!value.empty() && key.find("pattern")==std::string::npos) { + if (!value.empty()) { stream << " <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << OBJECT_TYPE << "\" " << KEY_ATTR << "=\"" << key << "\" " << VALUE_ATTR << "=\"" << value << "\"/>\n"; } else { std::ofstream log("ERROR_FILE_TO_SEND_TO_MERILL_PLZZZZ.txt", std::ios_base::app); @@ -3170,6 +3170,9 @@ namespace Slic3r { log << "\n"; } if (obj->config.option(key) != nullptr && obj->config.option(key)->type() == ConfigOptionType::coEnum) { + try{ + log << "raw_int_value : " << obj->config.option(key)->getInt() << "\n"; + } catch (std::exception ex) {} log << "enum : " << obj->config.option(key)->getInt(); log << "\n"; const ConfigOptionDef* def = nullptr; @@ -3269,12 +3272,15 @@ namespace Slic3r { stream << " <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << key << "\" " << VALUE_ATTR << "=\"" << value << "\"/>\n"; } else { std::ofstream log("ERROR_FILE_TO_SEND_TO_MERILL_PLZZZZ.txt", std::ios_base::app); - log << "error in model, can't serialize " << key << ": '" << value << "' " << ((volume->config.option(key) != nullptr)?"exist":"doesn't exist") << "\n"; + log << "error in volume, can't serialize " << key << ": '" << value << "' " << ((volume->config.option(key) != nullptr)?"exist":"doesn't exist") << "\n"; if (volume->config.option(key) != nullptr) { log << "type : " << volume->config.option(key)->type(); log << "\n"; } if (volume->config.option(key) != nullptr && volume->config.option(key)->type() == ConfigOptionType::coEnum) { + try{ + log << "raw_int_value : " << volume->config.option(key)->getInt() << "\n"; + } catch (std::exception ex) {} log << "enum : " << volume->config.option(key)->getInt(); log << "\n"; const ConfigOptionDef* def = nullptr; From 35eb355eb2f7694d26fb2b797f2defdffc582974 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 20 Nov 2023 21:12:20 +0100 Subject: [PATCH 4/4] typo supermerill/SuperSlicer#3941 thanks to @tocguy --- src/libslic3r/PrintConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3980aa9f0ea..1d8700dd169 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -6236,9 +6236,9 @@ void PrintConfigDef::init_fff_params() def->label = L("Roundness margin"); def->full_label = L("Polyhole detection margin"); def->category = OptionCategory::slicing; - def->tooltip = L("Maximum defection of a point to the estimated radius of the circle." + def->tooltip = L("Maximum deflection of a point to the estimated radius of the circle." "\nAs cylinders are often exported as triangles of varying size, points may not be on the circle circumference." - " This setting allows you some leway to broaden the detection." + " This setting allows you some leeway to broaden the detection." "\nIn mm or in % of the radius."); def->sidetext = L("mm or %"); def->max_literal = { 10, false};