mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 02:35:54 +08:00
Selecting SLA printer on Connect upload
This commit is contained in:
parent
13ac78f8e9
commit
58cd6c5a09
@ -5877,11 +5877,15 @@ void Plater::connect_gcode()
|
|||||||
}
|
}
|
||||||
// Selected profiles
|
// Selected profiles
|
||||||
const Preset* selected_printer_preset = &preset_bundle->printers.get_selected_preset();
|
const Preset* selected_printer_preset = &preset_bundle->printers.get_selected_preset();
|
||||||
const Preset* selected_filament_preset = &preset_bundle->filaments.get_selected_preset();
|
|
||||||
const std::string selected_nozzle_serialized = dynamic_cast<const ConfigOptionFloats*>(selected_printer_preset->config.option("nozzle_diameter"))->serialize();
|
|
||||||
const std::string selected_filament_type_serialized = selected_filament_preset->config.option("filament_type")->serialize();
|
|
||||||
const std::string selected_printer_model_serialized = selected_printer_preset->config.option("printer_model")->serialize();
|
const std::string selected_printer_model_serialized = selected_printer_preset->config.option("printer_model")->serialize();
|
||||||
|
std::string selected_filament_type_serialized;
|
||||||
|
if (Preset::printer_technology(selected_printer_preset->config) == ptFFF) {
|
||||||
|
const Preset* selected_filament_preset = &preset_bundle->filaments.get_selected_preset();
|
||||||
|
const std::string selected_nozzle_serialized = dynamic_cast<const ConfigOptionFloats*>(selected_printer_preset->config.option("nozzle_diameter"))->serialize();
|
||||||
|
std::string selected_filament_type_serialized = selected_filament_preset->config.option("filament_type")->serialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_first = compatible_printer_presets.front()->name == selected_printer_preset->name;
|
bool is_first = compatible_printer_presets.front()->name == selected_printer_preset->name;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (const Preset* connect_preset : compatible_printer_presets) {
|
for (const Preset* connect_preset : compatible_printer_presets) {
|
||||||
@ -5932,7 +5936,7 @@ void Plater::connect_gcode()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_filament_type_serialized != connect_filament_type) {
|
if (!selected_filament_type_serialized.empty() && selected_filament_type_serialized != connect_filament_type) {
|
||||||
wxString line1 = _L("The printer you've selected has different filament type than filament profile selected for slicing.");
|
wxString line1 = _L("The printer you've selected has different filament type than filament profile selected for slicing.");
|
||||||
wxString line2 = GUI::format_wxstr(_L("PrusaConnect Filament Type: %1%"), connect_filament_type);
|
wxString line2 = GUI::format_wxstr(_L("PrusaConnect Filament Type: %1%"), connect_filament_type);
|
||||||
wxString line3 = GUI::format_wxstr(_L("PrusaSlicer Filament Type: %1%"), selected_filament_type_serialized);
|
wxString line3 = GUI::format_wxstr(_L("PrusaSlicer Filament Type: %1%"), selected_filament_type_serialized);
|
||||||
@ -5985,7 +5989,7 @@ void Plater::connect_gcode()
|
|||||||
show_error(this, _L("Failed to select a printer. Missing data (uuid and team id) for chosen printer."));
|
show_error(this, _L("Failed to select a printer. Missing data (uuid and team id) for chosen printer."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PhysicalPrinter ph_printer("connect_temp_printer", wxGetApp().preset_bundle->physical_printers.default_config(), /**connect_printer_preset*/*selected_printer_preset);
|
PhysicalPrinter ph_printer("connect_temp_printer", wxGetApp().preset_bundle->physical_printers.default_config(), *selected_printer_preset);
|
||||||
ph_printer.config.set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaConnectNew));
|
ph_printer.config.set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaConnectNew));
|
||||||
// use existing structures to pass data
|
// use existing structures to pass data
|
||||||
ph_printer.config.opt_string("printhost_apikey") = team_id;
|
ph_printer.config.opt_string("printhost_apikey") = team_id;
|
||||||
|
@ -96,6 +96,7 @@ private:
|
|||||||
{"2.1.0", "MINI" },
|
{"2.1.0", "MINI" },
|
||||||
{"3.1.0", "XL" },
|
{"3.1.0", "XL" },
|
||||||
{"5.1.0", "SL1" },
|
{"5.1.0", "SL1" },
|
||||||
|
{"5.1.1", "SL1S" },
|
||||||
// ysFIXME : needs to add Connect ids for next printers
|
// ysFIXME : needs to add Connect ids for next printers
|
||||||
/*{"0.0.0", "MK4IS" },
|
/*{"0.0.0", "MK4IS" },
|
||||||
{"0.0.0", "MK3SMMU2S" },
|
{"0.0.0", "MK3SMMU2S" },
|
||||||
|
@ -714,6 +714,16 @@ void PrinterPickWebViewDialog::on_request_update_selected_printer_action()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PrinterPickWebViewDialog::request_compatible_printers()
|
void PrinterPickWebViewDialog::request_compatible_printers()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (Preset::printer_technology(wxGetApp().preset_bundle->printers.get_selected_preset().config) == ptFFF) {
|
||||||
|
request_compatible_printers_FFF();
|
||||||
|
} else {
|
||||||
|
request_compatible_printers_SLA();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrinterPickWebViewDialog::request_compatible_printers_FFF()
|
||||||
{
|
{
|
||||||
//PrinterParams: {
|
//PrinterParams: {
|
||||||
//material: Material;
|
//material: Material;
|
||||||
@ -727,14 +737,29 @@ void PrinterPickWebViewDialog::request_compatible_printers()
|
|||||||
const std::string printer_model_serialized = selected_printer.config.option("printer_model")->serialize();
|
const std::string printer_model_serialized = selected_printer.config.option("printer_model")->serialize();
|
||||||
const std::string printer_type = wxGetApp().plater()->get_user_account()->get_printer_type_from_name(printer_model_serialized);
|
const std::string printer_type = wxGetApp().plater()->get_user_account()->get_printer_type_from_name(printer_model_serialized);
|
||||||
|
|
||||||
// assert(!filament_type_serialized.empty() && !nozzle_diameter_serialized.empty() && !printer_type.empty());
|
|
||||||
const std::string request = GUI::format(
|
const std::string request = GUI::format(
|
||||||
"{"
|
"{"
|
||||||
"\"material\": \"%1%\", "
|
"\"material\": \"%1%\", "
|
||||||
"\"nozzleDiameter\": %2%, "
|
"\"nozzleDiameter\": %2%, "
|
||||||
"\"printerType\": \"%3%\" "
|
"\"printerType\": \"%3%\" "
|
||||||
"}", filament_type_serialized, nozzle_diameter_serialized, printer_type);
|
"}", filament_type_serialized, nozzle_diameter_serialized, printer_type);
|
||||||
|
|
||||||
|
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
||||||
|
run_script(script);
|
||||||
|
}
|
||||||
|
void PrinterPickWebViewDialog::request_compatible_printers_SLA()
|
||||||
|
{
|
||||||
|
const Preset& selected_printer = wxGetApp().preset_bundle->printers.get_selected_preset();
|
||||||
|
const std::string printer_model_serialized = selected_printer.config.option("printer_model")->serialize();
|
||||||
|
const std::string printer_type = wxGetApp().plater()->get_user_account()->get_printer_type_from_name(printer_model_serialized);
|
||||||
|
const Preset& selected_material = wxGetApp().preset_bundle->sla_materials.get_selected_preset();
|
||||||
|
const std::string material_type_serialized = selected_material.config.option("material_type")->serialize();
|
||||||
|
const std::string request = GUI::format(
|
||||||
|
"{"
|
||||||
|
"\"material\": \"%1%\", "
|
||||||
|
"\"printerType\": \"%2%\" "
|
||||||
|
"}", material_type_serialized, printer_type);
|
||||||
|
|
||||||
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
||||||
run_script(script);
|
run_script(script);
|
||||||
}
|
}
|
||||||
|
@ -169,6 +169,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void on_request_update_selected_printer_action() override;
|
void on_request_update_selected_printer_action() override;
|
||||||
void request_compatible_printers() override;
|
void request_compatible_printers() override;
|
||||||
|
void request_compatible_printers_FFF();
|
||||||
|
void request_compatible_printers_SLA();
|
||||||
void run_script_bridge(const wxString& script) override { run_script(script); }
|
void run_script_bridge(const wxString& script) override { run_script(script); }
|
||||||
private:
|
private:
|
||||||
std::string& m_ret_val;
|
std::string& m_ret_val;
|
||||||
|
@ -70,6 +70,10 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config)
|
|||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const auto opt = config->option<ConfigOptionEnum<PrintHostType>>("host_type");
|
||||||
|
if (opt != nullptr && opt->value == htPrusaConnectNew) {
|
||||||
|
return new PrusaConnectNew(config);
|
||||||
|
}
|
||||||
return new SL1Host(config);
|
return new SL1Host(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user