update src

This commit is contained in:
QIDI TECH
2025-08-18 10:34:25 +08:00
parent 15dd71693d
commit dab82d0248
11 changed files with 87 additions and 68 deletions

View File

@@ -60,9 +60,10 @@ std::string escape_string_cstyle(const std::string &str)
} else if (c == '\n') { } else if (c == '\n') {
(*outptr ++) = '\\'; (*outptr ++) = '\\';
(*outptr ++) = 'n'; (*outptr ++) = 'n';
} else if (c == '\\') { //y70
(*outptr ++) = '\\'; } else if (c == '\\' || c == '"') {
(*outptr ++) = '\\'; (*outptr++) = '\\';
(*outptr++) = c;
} else } else
(*outptr ++) = c; (*outptr ++) = c;
} }
@@ -950,36 +951,44 @@ int ConfigBase::load_from_json(const std::string &file, ConfigSubstitutionContex
} }
} }
char single_sep = ','; //y70
char array_sep = '#'; // currenty not used bool use_comma = true;
bool escape_string_type = false;
if (optdef) { if (optdef && optdef->type == coStrings) {
switch (optdef->type) use_comma = false;
{ }
case coStrings: for (auto iter = it.value().begin(); iter != it.value().end(); iter++) {
escape_string_type = true; if (iter.value().is_string()) {
single_sep = ';'; if (!first) {
break; if (use_comma)
case coPointsGroups: value_str += ",";
single_sep = '#'; else
break; value_str += ";";
default: }
else
first = false;
if (use_comma)
value_str += iter.value();
else {
value_str += "\"";
value_str += escape_string_cstyle(iter.value());
value_str += "\"";
}
}
else {
//should not happen
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << file << " error, invalid json array for " << it.key();
valid = false;
break; break;
} }
} }
// QDS: we only support 2 depth array
valid = parse_str_arr(it, single_sep, array_sep,escape_string_type, value_str);
if (!valid) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << file << " error, invalid json array for " << it.key();
break;
}
if (valid) if (valid)
this->set_deserialize(opt_key, value_str, substitution_context); this->set_deserialize(opt_key, value_str, substitution_context);
} }
else { else {
//should not happen //should not happen
BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": parse "<<file<<" error, invalid json type for " << it.key(); BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << file << " error, invalid json type for " << it.key();
} }
} }
} }

View File

@@ -2924,15 +2924,14 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
activate_air_filtration |= m_config.activate_air_filtration.get_at(extruder.id()); activate_air_filtration |= m_config.activate_air_filtration.get_at(extruder.id());
activate_air_filtration &= m_config.support_air_filtration.getBool(); activate_air_filtration &= m_config.support_air_filtration.getBool();
//w36 if (activate_air_filtration) {
/*if (activate_air_filtration) {
int complete_print_exhaust_fan_speed = 0; int complete_print_exhaust_fan_speed = 0;
for (const auto& extruder : m_writer.extruders()) for (const auto& extruder : m_writer.extruders())
if (m_config.activate_air_filtration.get_at(extruder.id())) if (m_config.activate_air_filtration.get_at(extruder.id()))
complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id())); complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id()));
file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true)); file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true));
}*/ }
file.write(m_writer.set_exhaust_fan(0, true));
//w25 //w25
file.write(DoExport::update_print_stats_and_format_filament_stats( file.write(DoExport::update_print_stats_and_format_filament_stats(
// Const inputs // Const inputs

View File

@@ -2844,8 +2844,9 @@ WipeTower::ToolChangeResult WipeTower::merge_tcr(ToolChangeResult &first, ToolCh
assert(first.new_tool == second.initial_tool); assert(first.new_tool == second.initial_tool);
WipeTower::ToolChangeResult out = first; WipeTower::ToolChangeResult out = first;
if ((first.end_pos - second.start_pos).norm() > (float)EPSILON) { if ((first.end_pos - second.start_pos).norm() > (float)EPSILON) {
//y70
std::string travel_gcode = "G1 X" + Slic3r::float_to_string_decimal_point(second.start_pos.x(), 3) + " Y" + std::string travel_gcode = "G1 X" + Slic3r::float_to_string_decimal_point(second.start_pos.x(), 3) + " Y" +
Slic3r::float_to_string_decimal_point(second.start_pos.y(), 3) + " F" + std::to_string(m_max_speed) + "\n"; Slic3r::float_to_string_decimal_point(second.start_pos.y(), 3) + " F" + Slic3r::float_to_string_decimal_point(m_max_speed, 3) + "\n";
bool need_insert_travel = true; bool need_insert_travel = true;
if (second.is_tool_change if (second.is_tool_change
&& is_approx(second.start_pos.x(), second.tool_change_start_pos.x()) && is_approx(second.start_pos.x(), second.tool_change_start_pos.x())

View File

@@ -501,7 +501,7 @@ void PresetBundle::reset_project_embedded_presets()
if (!prefered_filament_profile.empty()) if (!prefered_filament_profile.empty())
filament_presets[i] = prefered_filament_profile; filament_presets[i] = prefered_filament_profile;
else else
filament_presets[i] = this->filaments.first_visible().name; filament_presets[i] = this->filaments.first_visible().name;
} }
} }
} }

View File

@@ -22,6 +22,7 @@ DeviceItem::DeviceItem(wxWindow* parent, MachineObject* obj)
obj_->dev_name = obj->dev_name; obj_->dev_name = obj->dev_name;
obj_->dev_url = obj->dev_url; obj_->dev_url = obj->dev_url;
obj_->dev_ip = obj->dev_ip; obj_->dev_ip = obj->dev_ip;
obj_->dev_apikey = obj->dev_apikey; //y70
sync_state(); sync_state();
Bind(EVT_MULTI_REFRESH, &DeviceItem::on_refresh, this); Bind(EVT_MULTI_REFRESH, &DeviceItem::on_refresh, this);
} }

View File

@@ -501,7 +501,7 @@ void PhysicalPrinterDialog::OnOK(wxMouseEvent& event)
} }
for (auto exit_host : m_exit_host) for (auto exit_host : m_exit_host)
{ {
if (exit_host.find(ip) != std::string::npos) if (exit_host == ip)
{ {
MessageDialog msg_wingow(nullptr, _L("A device with the same host (IP or URL) already exists, please re-enter."), "", wxICON_WARNING | wxOK); MessageDialog msg_wingow(nullptr, _L("A device with the same host (IP or URL) already exists, please re-enter."), "", wxICON_WARNING | wxOK);
msg_wingow.ShowModal(); msg_wingow.ShowModal();

View File

@@ -5945,32 +5945,32 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
show_info(q, _L("The 3mf is not from QIDI Tech, load geometry data only."), _L("Load 3mf")); show_info(q, _L("The 3mf is not from QIDI Tech, load geometry data only."), _L("Load 3mf"));
} }
//w18 //w18
else if (load_config && (file_version.maj() != app_version.maj())) { // else if (load_config && (file_version.maj() != app_version.maj())) {
// version mismatch, only load geometries // // version mismatch, only load geometries
load_config = false; // load_config = false;
if (!load_model) { // if (!load_model) {
// only load config case, return directly // // only load config case, return directly
show_info(q, _L("The Config can not be loaded."), _L("Load 3mf")); // show_info(q, _L("The Config can not be loaded."), _L("Load 3mf"));
q->skip_thumbnail_invalid = false; // q->skip_thumbnail_invalid = false;
return empty_result; // return empty_result;
} // }
load_old_project = true; // load_old_project = true;
// select view to 3D // // select view to 3D
q->select_view_3D("3D"); // q->select_view_3D("3D");
// select plate 0 as default // // select plate 0 as default
q->select_plate(0); // q->select_plate(0);
if (load_type != LoadType::LoadGeometry) { // if (load_type != LoadType::LoadGeometry) {
if (en_3mf_file_type == En3mfType::From_QDS) // if (en_3mf_file_type == En3mfType::From_QDS)
show_info(q, _L("Due to the lower version of QIDI Studio, this 3mf file cannot be fully loaded. Please update QIDI Studio to the latest version"), _L("Load 3mf")); // show_info(q, _L("Due to the lower version of QIDI Studio, this 3mf file cannot be fully loaded. Please update QIDI Studio to the latest version"), _L("Load 3mf"));
else // else
show_info(q, _L("The 3mf is not from QIDI Tech, load geometry data only."), _L("Load 3mf")); // show_info(q, _L("The 3mf is not from QIDI Tech, load geometry data only."), _L("Load 3mf"));
} // }
for (ModelObject *model_object : model.objects) { // for (ModelObject *model_object : model.objects) {
model_object->config.reset(); // model_object->config.reset();
// Is there any modifier or advanced config data? // // Is there any modifier or advanced config data?
for (ModelVolume *model_volume : model_object->volumes) model_volume->config.reset(); // for (ModelVolume *model_volume : model_object->volumes) model_volume->config.reset();
} // }
} // }
//y54 //y54
// // else if (load_config && (file_version > app_version)) { // // else if (load_config && (file_version > app_version)) {
// Semver cloud_ver; // Semver cloud_ver;
@@ -12704,7 +12704,7 @@ void Plater::_calib_pa_line(const Calib_Params& params)
tab_print->load_config(new_config); tab_print->load_config(new_config);
tab_printer->load_config(new_config); tab_printer->load_config(new_config);
GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->get_gizmos_manager().get_object_manipulation(); GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->get_gizmos_manager().get_object_manipulation();
giz_obj_manip.set_uniform_scaling(true); giz_obj_manip.set_uniform_scaling(false);
giz_obj_manip.on_change("position", 0, plate_center.x() - 50); giz_obj_manip.on_change("position", 0, plate_center.x() - 50);
giz_obj_manip.set_uniform_scaling(false); giz_obj_manip.set_uniform_scaling(false);
giz_obj_manip.on_change("size", 0, 25); giz_obj_manip.on_change("size", 0, 25);
@@ -12941,7 +12941,7 @@ void Plater::_calib_pa_pattern(const Calib_Params &params)
tab_printer->load_config(new_config); tab_printer->load_config(new_config);
GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->get_gizmos_manager().get_object_manipulation(); GizmoObjectManipulation& giz_obj_manip = p->view3D->get_canvas3d()->get_gizmos_manager().get_object_manipulation();
giz_obj_manip.set_uniform_scaling(true); giz_obj_manip.set_uniform_scaling(false);
giz_obj_manip.on_change("position", 0, plate_center.x() - 31); giz_obj_manip.on_change("position", 0, plate_center.x() - 31);
giz_obj_manip.set_uniform_scaling(false); giz_obj_manip.set_uniform_scaling(false);
giz_obj_manip.on_change("size", 0, 25); giz_obj_manip.on_change("size", 0, 25);

View File

@@ -3601,10 +3601,8 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
has_box_machine = true; has_box_machine = true;
} }
//y68 y69 //y68 //y70
PresetBundle& preset_bundle = *wxGetApp().preset_bundle; if(!preset_typename_normalized.empty() && preset_typename_normalized.find(NormalizeVendor(select_machine_type)) == std::string::npos && !selection_name.empty())
std::string machine_preset = preset_bundle.printers.get_edited_preset().get_printer_type(&preset_bundle);
if(!machine_preset.empty() && machine_preset != select_machine_type && !selection_name.empty())
{ {
show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter); show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter);
has_box_machine = false; has_box_machine = false;

View File

@@ -1888,7 +1888,8 @@ void SendMultiMachinePage::ThreadWorker() {
if (m_stopThread) if (m_stopThread)
break; break;
MachineObject* temp_obj = device.second->get_obj(); MachineObject* temp_obj = device.second->get_obj();
temp_obj->ams_exist_bits = qidi.get_box_state(msg, temp_obj->dev_url) ? 1 : 0; //y70
temp_obj->ams_exist_bits = qidi.get_box_state(msg, temp_obj->dev_url, temp_obj->dev_apikey) ? 1 : 0;
} }
} }
} }

View File

@@ -3286,6 +3286,7 @@ GetBoxInfoDialog::GetBoxInfoDialog(Plater* plater)
m_comboBox_printer->SetValue(""); m_comboBox_printer->SetValue("");
m_comboBox_printer->Clear(); m_comboBox_printer->Clear();
m_printer_ip.clear(); m_printer_ip.clear();
m_printer_api_key.clear(); //y70
PresetBundle& preset_bundle = *wxGetApp().preset_bundle; PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
PhysicalPrinterCollection& ph_printers = preset_bundle.physical_printers; PhysicalPrinterCollection& ph_printers = preset_bundle.physical_printers;
std::string preset_typename = NormalizeVendor(preset_bundle.printers.get_edited_preset().get_printer_type(&preset_bundle)); std::string preset_typename = NormalizeVendor(preset_bundle.printers.get_edited_preset().get_printer_type(&preset_bundle));
@@ -3296,6 +3297,8 @@ GetBoxInfoDialog::GetBoxInfoDialog(Plater* plater)
if (preset_typename.find(NormalizeVendor(printer_preset)) != std::string::npos) { if (preset_typename.find(NormalizeVendor(printer_preset)) != std::string::npos) {
m_comboBox_printer->Append(from_u8(printer_name)); m_comboBox_printer->Append(from_u8(printer_name));
m_printer_ip.push_back((it->config.opt_string("print_host"))); m_printer_ip.push_back((it->config.opt_string("print_host")));
//y70
m_printer_api_key.push_back((it->config.opt_string("printhost_apikey")));
} }
} }
m_comboBox_printer->SetSelection(0); m_comboBox_printer->SetSelection(0);
@@ -3399,18 +3402,24 @@ void GetBoxInfoDialog::synchronization(wxCommandEvent &event)
int selected_idx = m_comboBox_printer->GetSelection(); int selected_idx = m_comboBox_printer->GetSelection();
std::string printer_ip = m_printer_ip[selected_idx]; std::string printer_ip = m_printer_ip[selected_idx];
//y70
std::string api_key = "";
if(!m_printer_api_key.empty())
api_key = m_printer_api_key[selected_idx];
QIDINetwork qidi; QIDINetwork qidi;
wxString msg = ""; wxString msg = "";
bool has_box = qidi.get_box_state(msg, printer_ip); bool has_box = qidi.get_box_state(msg, printer_ip, api_key); //y70
if (!has_box) { if (!has_box) {
WarningDialog(this, _L("This Printer has not connect the box, please check.")).ShowModal(); WarningDialog(this, _L("This Printer has not connect the box, please check.")).ShowModal();
} }
else { else {
//y70
//Get Box_info //Get Box_info
GUI::Box_info filament_info; GUI::Box_info filament_info;
filament_info = qidi.get_box_info(msg, printer_ip); filament_info = qidi.get_box_info(msg, printer_ip, api_key);
m_plater->current_box_info = filament_info; m_plater->current_box_info = filament_info;
qidi.get_color_filament_str(msg, filament_info, printer_ip); qidi.get_color_filament_str(msg, filament_info, printer_ip, api_key);
generate_filament_id(filament_info); generate_filament_id(filament_info);
update_filament_info(filament_info); update_filament_info(filament_info);
wxGetApp().plater()->sidebar().box_list_printer_ip = printer_ip; wxGetApp().plater()->sidebar().box_list_printer_ip = printer_ip;

View File

@@ -390,6 +390,7 @@ public:
std::vector<std::string> m_printer_ip; std::vector<std::string> m_printer_ip;
std::vector<std::string> m_printer_api_key;
private: private:
Plater* m_plater{ nullptr }; Plater* m_plater{ nullptr };