mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-01-31 00:48:41 +03:00
update src
This commit is contained in:
@@ -60,9 +60,10 @@ std::string escape_string_cstyle(const std::string &str)
|
||||
} else if (c == '\n') {
|
||||
(*outptr ++) = '\\';
|
||||
(*outptr ++) = 'n';
|
||||
} else if (c == '\\') {
|
||||
(*outptr ++) = '\\';
|
||||
(*outptr ++) = '\\';
|
||||
//y70
|
||||
} else if (c == '\\' || c == '"') {
|
||||
(*outptr++) = '\\';
|
||||
(*outptr++) = c;
|
||||
} else
|
||||
(*outptr ++) = c;
|
||||
}
|
||||
@@ -950,36 +951,44 @@ int ConfigBase::load_from_json(const std::string &file, ConfigSubstitutionContex
|
||||
}
|
||||
}
|
||||
|
||||
char single_sep = ',';
|
||||
char array_sep = '#'; // currenty not used
|
||||
bool escape_string_type = false;
|
||||
if (optdef) {
|
||||
switch (optdef->type)
|
||||
{
|
||||
case coStrings:
|
||||
escape_string_type = true;
|
||||
single_sep = ';';
|
||||
break;
|
||||
case coPointsGroups:
|
||||
single_sep = '#';
|
||||
break;
|
||||
default:
|
||||
//y70
|
||||
bool use_comma = true;
|
||||
|
||||
if (optdef && optdef->type == coStrings) {
|
||||
use_comma = false;
|
||||
}
|
||||
for (auto iter = it.value().begin(); iter != it.value().end(); iter++) {
|
||||
if (iter.value().is_string()) {
|
||||
if (!first) {
|
||||
if (use_comma)
|
||||
value_str += ",";
|
||||
else
|
||||
value_str += ";";
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
this->set_deserialize(opt_key, value_str, substitution_context);
|
||||
}
|
||||
else {
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.support_air_filtration.getBool();
|
||||
|
||||
//w36
|
||||
/*if (activate_air_filtration) {
|
||||
if (activate_air_filtration) {
|
||||
int complete_print_exhaust_fan_speed = 0;
|
||||
for (const auto& extruder : m_writer.extruders())
|
||||
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()));
|
||||
file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true));
|
||||
}*/
|
||||
file.write(m_writer.set_exhaust_fan(0, true));
|
||||
}
|
||||
|
||||
//w25
|
||||
file.write(DoExport::update_print_stats_and_format_filament_stats(
|
||||
// Const inputs
|
||||
|
||||
@@ -2844,8 +2844,9 @@ WipeTower::ToolChangeResult WipeTower::merge_tcr(ToolChangeResult &first, ToolCh
|
||||
assert(first.new_tool == second.initial_tool);
|
||||
WipeTower::ToolChangeResult out = first;
|
||||
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" +
|
||||
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;
|
||||
if (second.is_tool_change
|
||||
&& is_approx(second.start_pos.x(), second.tool_change_start_pos.x())
|
||||
|
||||
@@ -501,7 +501,7 @@ void PresetBundle::reset_project_embedded_presets()
|
||||
if (!prefered_filament_profile.empty())
|
||||
filament_presets[i] = prefered_filament_profile;
|
||||
else
|
||||
filament_presets[i] = this->filaments.first_visible().name;
|
||||
filament_presets[i] = this->filaments.first_visible().name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ DeviceItem::DeviceItem(wxWindow* parent, MachineObject* obj)
|
||||
obj_->dev_name = obj->dev_name;
|
||||
obj_->dev_url = obj->dev_url;
|
||||
obj_->dev_ip = obj->dev_ip;
|
||||
obj_->dev_apikey = obj->dev_apikey; //y70
|
||||
sync_state();
|
||||
Bind(EVT_MULTI_REFRESH, &DeviceItem::on_refresh, this);
|
||||
}
|
||||
|
||||
@@ -501,7 +501,7 @@ void PhysicalPrinterDialog::OnOK(wxMouseEvent& event)
|
||||
}
|
||||
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);
|
||||
msg_wingow.ShowModal();
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
//w18
|
||||
else if (load_config && (file_version.maj() != app_version.maj())) {
|
||||
// version mismatch, only load geometries
|
||||
load_config = false;
|
||||
if (!load_model) {
|
||||
// only load config case, return directly
|
||||
show_info(q, _L("The Config can not be loaded."), _L("Load 3mf"));
|
||||
q->skip_thumbnail_invalid = false;
|
||||
return empty_result;
|
||||
}
|
||||
load_old_project = true;
|
||||
// select view to 3D
|
||||
q->select_view_3D("3D");
|
||||
// select plate 0 as default
|
||||
q->select_plate(0);
|
||||
if (load_type != LoadType::LoadGeometry) {
|
||||
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"));
|
||||
else
|
||||
show_info(q, _L("The 3mf is not from QIDI Tech, load geometry data only."), _L("Load 3mf"));
|
||||
}
|
||||
for (ModelObject *model_object : model.objects) {
|
||||
model_object->config.reset();
|
||||
// Is there any modifier or advanced config data?
|
||||
for (ModelVolume *model_volume : model_object->volumes) model_volume->config.reset();
|
||||
}
|
||||
}
|
||||
// else if (load_config && (file_version.maj() != app_version.maj())) {
|
||||
// // version mismatch, only load geometries
|
||||
// load_config = false;
|
||||
// if (!load_model) {
|
||||
// // only load config case, return directly
|
||||
// show_info(q, _L("The Config can not be loaded."), _L("Load 3mf"));
|
||||
// q->skip_thumbnail_invalid = false;
|
||||
// return empty_result;
|
||||
// }
|
||||
// load_old_project = true;
|
||||
// // select view to 3D
|
||||
// q->select_view_3D("3D");
|
||||
// // select plate 0 as default
|
||||
// q->select_plate(0);
|
||||
// if (load_type != LoadType::LoadGeometry) {
|
||||
// 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"));
|
||||
// else
|
||||
// show_info(q, _L("The 3mf is not from QIDI Tech, load geometry data only."), _L("Load 3mf"));
|
||||
// }
|
||||
// for (ModelObject *model_object : model.objects) {
|
||||
// model_object->config.reset();
|
||||
// // Is there any modifier or advanced config data?
|
||||
// for (ModelVolume *model_volume : model_object->volumes) model_volume->config.reset();
|
||||
// }
|
||||
// }
|
||||
//y54
|
||||
// // else if (load_config && (file_version > app_version)) {
|
||||
// Semver cloud_ver;
|
||||
@@ -12704,7 +12704,7 @@ void Plater::_calib_pa_line(const Calib_Params& params)
|
||||
tab_print->load_config(new_config);
|
||||
tab_printer->load_config(new_config);
|
||||
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.set_uniform_scaling(false);
|
||||
giz_obj_manip.on_change("size", 0, 25);
|
||||
@@ -12941,7 +12941,7 @@ void Plater::_calib_pa_pattern(const Calib_Params ¶ms)
|
||||
tab_printer->load_config(new_config);
|
||||
|
||||
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.set_uniform_scaling(false);
|
||||
giz_obj_manip.on_change("size", 0, 25);
|
||||
|
||||
@@ -3601,10 +3601,8 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
|
||||
has_box_machine = true;
|
||||
}
|
||||
|
||||
//y68 y69
|
||||
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
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())
|
||||
//y68 //y70
|
||||
if(!preset_typename_normalized.empty() && preset_typename_normalized.find(NormalizeVendor(select_machine_type)) == std::string::npos && !selection_name.empty())
|
||||
{
|
||||
show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter);
|
||||
has_box_machine = false;
|
||||
|
||||
@@ -1888,7 +1888,8 @@ void SendMultiMachinePage::ThreadWorker() {
|
||||
if (m_stopThread)
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3286,6 +3286,7 @@ GetBoxInfoDialog::GetBoxInfoDialog(Plater* plater)
|
||||
m_comboBox_printer->SetValue("");
|
||||
m_comboBox_printer->Clear();
|
||||
m_printer_ip.clear();
|
||||
m_printer_api_key.clear(); //y70
|
||||
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
PhysicalPrinterCollection& ph_printers = preset_bundle.physical_printers;
|
||||
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) {
|
||||
m_comboBox_printer->Append(from_u8(printer_name));
|
||||
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);
|
||||
@@ -3399,18 +3402,24 @@ void GetBoxInfoDialog::synchronization(wxCommandEvent &event)
|
||||
int selected_idx = m_comboBox_printer->GetSelection();
|
||||
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;
|
||||
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) {
|
||||
WarningDialog(this, _L("This Printer has not connect the box, please check.")).ShowModal();
|
||||
}
|
||||
else {
|
||||
//y70
|
||||
//Get Box_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;
|
||||
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);
|
||||
update_filament_info(filament_info);
|
||||
wxGetApp().plater()->sidebar().box_list_printer_ip = printer_ip;
|
||||
|
||||
@@ -390,6 +390,7 @@ public:
|
||||
|
||||
|
||||
std::vector<std::string> m_printer_ip;
|
||||
std::vector<std::string> m_printer_api_key;
|
||||
|
||||
private:
|
||||
Plater* m_plater{ nullptr };
|
||||
|
||||
Reference in New Issue
Block a user