diff --git a/src/slic3r/Utils/PrintagoServer.cpp b/src/slic3r/Utils/PrintagoServer.cpp index 733c14fa209..3b197b987d6 100644 --- a/src/slic3r/Utils/PrintagoServer.cpp +++ b/src/slic3r/Utils/PrintagoServer.cpp @@ -719,7 +719,9 @@ bool PrintagoDirector::ProcessPrintagoCommand(const PrintagoCommand& cmd) actionDetail = wxString::Format("slice_config: %s", PBJob::localFile.GetFullPath()); - OverridePrintSettings(); + if (!PBJob::configFiles["print_override"].GetFullPath().IsEmpty()) { + OverridePrintSettings(); + } ImportPrintagoConfigs(); SetPrintagoConfigs(); wxGetApp().plater()->sidebar().on_bed_type_change(PBJob::bed_type); diff --git a/src/slic3r/Utils/PrintagoServer.hpp b/src/slic3r/Utils/PrintagoServer.hpp index 63a647a900e..e5fed11fdbb 100644 --- a/src/slic3r/Utils/PrintagoServer.hpp +++ b/src/slic3r/Utils/PrintagoServer.hpp @@ -110,10 +110,10 @@ class PrintagoCommand json GetOriginalCommand() const { return m_original_command; } private: - wxString m_command_type; - wxString m_action; - json m_parameters; - json m_original_command; + wxString m_command_type; + wxString m_action; + json m_parameters; + json m_original_command; }; //`````````````````````````````````````````````````` @@ -186,13 +186,20 @@ class PrintagoDirector void PostStatusMessage(const wxString& printer_id, const json& statusData, const json& command = {}); void PostResponseMessage(const wxString& printer_id, const json& responseData, const json& command = {}); - void PostSuccessMessage(const wxString& printer_id, const wxString& localCommand, const json& command = {}, const wxString& localCommandDetail = ""); - void PostErrorMessage(const wxString& printer_id, const wxString& localCommand, const json& command = {}, const wxString& errorDetail = "", const bool shouldUnblock = false); + void PostSuccessMessage(const wxString& printer_id, + const wxString& localCommand, + const json& command = {}, + const wxString& localCommandDetail = ""); + void PostErrorMessage(const wxString& printer_id, + const wxString& localCommand, + const json& command = {}, + const wxString& errorDetail = "", + const bool shouldUnblock = false); void _PostResponse(const PrintagoResponse& response) const; - bool ValidatePrintagoCommand(const PrintagoCommand& cmd); - bool ProcessPrintagoCommand(const PrintagoCommand& command); + bool ValidatePrintagoCommand(const PrintagoCommand& cmd); + bool ProcessPrintagoCommand(const PrintagoCommand& command); json GetAllStatus(); void AddCurrentProcessJsonTo(json& statusObject); @@ -254,7 +261,6 @@ class PBJob bbl_do_flow_cali = false; GUI::wxGetApp().printago_director()->ResetMachineDialog(); - } m_can_process_job = can_process_job; @@ -263,68 +269,7 @@ class PBJob inline static bool m_can_process_job = true; inline static JobServerState m_serverState = JobServerState::Idle; -public: - static std::string serverStateStr() - { - switch (m_serverState) { - case JobServerState::Idle: return "idle"; - case JobServerState::Download: return "download"; - case JobServerState::Configure: return "configure"; - case JobServerState::Slicing: return "slicing"; - case JobServerState::Sending: return "sending"; - default: return "null"; - } - } - - const inline static std::map serverStateProgress = {{JobServerState::Idle, 0}, - {JobServerState::Download, 7}, - {JobServerState::Configure, 15}, - {JobServerState::Slicing, 25}, - {JobServerState::Sending, 90}}; - - inline static wxString jobId = "ptgo_default"; - inline static wxString printerId; - inline static json command; - inline static wxFileName localFile; - inline static std::unordered_map configFiles; - inline static int progress = 0; - - inline static bool use_ams = false; - inline static bool bbl_do_bed_leveling = false; - inline static bool bbl_do_flow_cali = false; - inline static BedType bed_type = BedType::btDefault; - - static BedType StringToBedType(const std::string& bedType) - { - if (bedType == "cool_plate") - return BedType::btPC; - else if (bedType == "eng_plate") - return BedType::btEP; - else if (bedType == "warm_plate") - return BedType::btPEI; - else if (bedType == "textured_pei") - return BedType::btPTE; - else - return BedType::btDefault; - } - - static void SetServerState(JobServerState new_state, bool postMessage = false) - { - if (new_state != m_serverState) - progress = serverStateProgress.at(new_state); - m_serverState = new_state; - - if (postMessage) - GUI::wxGetApp().printago_director()->PostJobUpdateMessage(); - } - - static JobServerState GetServerState() { return m_serverState; } - static bool CanProcessJob() { return m_can_process_job; } - static bool BlockJobProcessing() { return SetCanProcessJob(false); } - static bool UnblockJobProcessing() { return SetCanProcessJob(true); } - static std::vector PrintSettingsNotToOverride() { return dont_override_these_print_settings; } -private: - static std::vector dont_override_these_print_settings{ + inline static std::vector dont_override_these_print_settings{ "max_volumetric_extrusion_rate_slope", "max_volumetric_extrusion_rate_slope_segment_length", "inner_wall_speed", @@ -391,6 +336,67 @@ class PBJob "notes", "wiping_volumes_extruders", }; + +public: + static std::string serverStateStr() + { + switch (m_serverState) { + case JobServerState::Idle: return "idle"; + case JobServerState::Download: return "download"; + case JobServerState::Configure: return "configure"; + case JobServerState::Slicing: return "slicing"; + case JobServerState::Sending: return "sending"; + default: return "null"; + } + } + + const inline static std::map serverStateProgress = {{JobServerState::Idle, 0}, + {JobServerState::Download, 7}, + {JobServerState::Configure, 15}, + {JobServerState::Slicing, 25}, + {JobServerState::Sending, 90}}; + + inline static wxString jobId = "ptgo_default"; + inline static wxString printerId; + inline static json command; + inline static wxFileName localFile; + inline static std::unordered_map configFiles; + inline static int progress = 0; + + inline static bool use_ams = false; + inline static bool bbl_do_bed_leveling = false; + inline static bool bbl_do_flow_cali = false; + inline static BedType bed_type = BedType::btDefault; + + static BedType StringToBedType(const std::string& bedType) + { + if (bedType == "cool_plate") + return BedType::btPC; + else if (bedType == "eng_plate") + return BedType::btEP; + else if (bedType == "warm_plate") + return BedType::btPEI; + else if (bedType == "textured_pei") + return BedType::btPTE; + else + return BedType::btDefault; + } + + static void SetServerState(JobServerState new_state, bool postMessage = false) + { + if (new_state != m_serverState) + progress = serverStateProgress.at(new_state); + m_serverState = new_state; + + if (postMessage) + GUI::wxGetApp().printago_director()->PostJobUpdateMessage(); + } + + static JobServerState GetServerState() { return m_serverState; } + static bool CanProcessJob() { return m_can_process_job; } + static bool BlockJobProcessing() { return SetCanProcessJob(false); } + static bool UnblockJobProcessing() { return SetCanProcessJob(true); } + static std::vector PrintSettingsNotToOverride() { return dont_override_these_print_settings; } }; } // namespace Slic3r