From dd004ebffd02bece9136e9c7a5272d66512bc430 Mon Sep 17 00:00:00 2001 From: QIDI TECH <893239786@qq.com> Date: Sat, 30 Nov 2024 14:00:32 +0800 Subject: [PATCH] fix some bug --- src/libslic3r/Fill/Fill.cpp | 11 +++++++++-- src/libslic3r/Fill/FillCrossHatch.cpp | 2 +- src/libslic3r/GCode/GCodeProcessor.cpp | 11 +++++++++++ src/slic3r/GUI/BackgroundSlicingProcess.cpp | 7 +++++++ src/slic3r/GUI/BackgroundSlicingProcess.hpp | 2 ++ src/slic3r/GUI/Field.cpp | 2 ++ src/slic3r/GUI/PhysicalPrinterDialog.cpp | 10 +++++----- src/slic3r/GUI/Plater.cpp | 6 ++++++ src/slic3r/GUI/Plater.hpp | 3 +++ src/slic3r/GUI/SelectMachine.cpp | 4 +++- src/slic3r/GUI/SendMultiMachinePage.cpp | 3 ++- 11 files changed, 51 insertions(+), 10 deletions(-) diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index f9015f9..f801ff1 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -663,12 +663,16 @@ void Layer::make_ironing() return true; if (this->angle > rhs.angle) return false; + if (this->inset < rhs.inset) + return true; + if (this->inset > rhs.inset) + return false; return false; } bool operator==(const IroningParams &rhs) const { return this->extruder == rhs.extruder && this->just_infill == rhs.just_infill && - this->line_spacing == rhs.line_spacing && this->height == rhs.height && this->speed == rhs.speed && this->angle == rhs.angle && this->pattern == rhs.pattern; + this->line_spacing == rhs.line_spacing && this->height == rhs.height && this->speed == rhs.speed && this->angle == rhs.angle && this->pattern == rhs.pattern && this->inset == rhs.inset; } LayerRegion *layerm = nullptr; @@ -712,6 +716,7 @@ void Layer::make_ironing() //TODO just_infill is currently not used. ironing_params.just_infill = false; ironing_params.line_spacing = config.ironing_spacing; + ironing_params.inset = config.ironing_inset; ironing_params.height = default_layer_height * 0.01 * config.ironing_flow; ironing_params.speed = config.ironing_speed; ironing_params.angle = (int(config.ironing_direction.value+layerm->region().config().infill_direction.value)%180) * M_PI / 180.; @@ -802,7 +807,9 @@ void Layer::make_ironing() polys = union_safety_offset(polys); } // Trim the top surfaces with half the nozzle diameter. - ironing_areas = intersection_ex(polys, offset(this->lslices, - float(scale_(0.5 * nozzle_dmr)))); + //QDS: ironing inset + double ironing_areas_offset = ironing_params.inset == 0 ? float(scale_(0.5 * nozzle_dmr)) : scale_(ironing_params.inset); + ironing_areas = intersection_ex(polys, offset(this->lslices, - ironing_areas_offset)); } // Create the filler object. diff --git a/src/libslic3r/Fill/FillCrossHatch.cpp b/src/libslic3r/Fill/FillCrossHatch.cpp index 850c50e..bbefd22 100644 --- a/src/libslic3r/Fill/FillCrossHatch.cpp +++ b/src/libslic3r/Fill/FillCrossHatch.cpp @@ -148,7 +148,7 @@ static Polylines generate_infill_layers(coordf_t z_height, double repeat_ratio, Polylines result; coordf_t trans_layer_size = grid_size * 0.4; // upper. coordf_t repeat_layer_size = grid_size * repeat_ratio; // lower. - z_height += repeat_layer_size / 2 + trans_layer_size; // offset to improve first few layer strength and reduce the risk of warpping. + z_height += repeat_layer_size / 2 ; // offset to improve first few layer strength and reduce the risk of warpping. coordf_t period = trans_layer_size + repeat_layer_size; coordf_t remains = z_height - std::floor(z_height / period) * period; coordf_t trans_z = remains - repeat_layer_size; // put repeat layer first. diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 4da4dde..715c9fd 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -3697,6 +3697,17 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line) m_seams_detector.activate(true); m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[m_extruder_id] - plate_offset); } + + //QDS: some layer may only has G3/G3, update right layer height + if (m_detect_layer_based_on_tag && !m_result.spiral_vase_layers.empty()) { + if (delta_pos[Z] >= 0.0 && type == EMoveType::Extrude && m_result.spiral_vase_layers.back().first == FLT_MAX) { + // replace layer height placeholder with correct value + m_result.spiral_vase_layers.back().first = static_cast(m_end_position[Z]); + } + if (!m_result.moves.empty()) + m_result.spiral_vase_layers.back().second.second = m_result.moves.size() - 1 - m_seams_count; + } + //QDS: store move store_move_vertex(type, m_move_path_type); } diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 3efa2e1..bf2f0c5 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -182,6 +182,13 @@ PrinterTechnology BackgroundSlicingProcess::current_printer_technology() const //return m_print->technology(); } +//y49 +std::string BackgroundSlicingProcess::output_filename_for_project() +{ + std::string filename = m_print->output_filename(""); + return filename; +} + std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::filesystem::path &project_path) { assert(m_print != nullptr); diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.hpp b/src/slic3r/GUI/BackgroundSlicingProcess.hpp index 41303f7..604bfe5 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.hpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.hpp @@ -125,6 +125,8 @@ public: // Take the project path (if provided), extract the name of the project, run it through the macro processor and save it next to the project file. // If the project_path is empty, just run output_filepath(). std::string output_filepath_for_project(const boost::filesystem::path &project_path); + //y49 + std::string output_filename_for_project(); // Start the background processing. Returns false if the background processing was already running. bool start(); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index f6ffe73..01a62d5 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -718,6 +718,8 @@ void TextCtrl::BUILD() { temp->SetLabel(_L(m_opt.sidetext)); auto text_ctrl = m_opt.multiline ? (wxTextCtrl *)temp : ((TextInput *) temp)->GetTextCtrl(); text_ctrl->SetLabel(text_value); + //y49 + temp->SetMinSize(size); temp->SetSize(size); m_combine_side_text = !m_opt.multiline; if (parent_is_custom_ctrl && m_opt.height < 0) diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index 210c364..21c94e0 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -251,18 +251,18 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr // Set a wider width for a better alignment Option option = m_optgroup->get_option("print_host"); - // option.opt.width = Field::def_width_wider(); - // 47 - option.opt.width = 20; + //y49 + option.opt.width = Field::def_width_wider() * 2; Line host_line = m_optgroup->create_single_option_line(option); host_line.append_widget(printhost_browse); host_line.append_widget(print_host_test); m_optgroup->append_line(host_line); - //y47 + //y49 option = m_optgroup->get_option("printhost_apikey"); - option.opt.width = 20; + option.opt.width = Field::def_width_wider() * 2; + option.opt.full_width = 1; m_optgroup->append_single_option_line(option); m_optgroup->activate(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 1a85946..16e4823 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -14076,6 +14076,12 @@ wxString Plater::get_project_filename(const wxString& extension) const return p->get_project_filename(extension); } +//y49 +wxString Plater::get_output_filename() +{ + return from_u8((p->background_process.output_filename_for_project())); +} + wxString Plater::get_export_gcode_filename(const wxString & extension, bool only_filename, bool export_all) const { return p->get_export_gcode_filename(extension, only_filename, export_all); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 8198cbb..b9a9cf6 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -469,6 +469,9 @@ public: // QDS //void show_action_buttons(const bool is_ready_to_slice) const; + //y49 + wxString get_output_filename(); + wxString get_project_filename(const wxString& extension = wxEmptyString) const; wxString get_export_gcode_filename(const wxString& extension = wxEmptyString, bool only_filename = false, bool export_all = false) const; void set_project_filename(const wxString& filename); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 1a5c02b..4b4d158 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -4055,7 +4055,9 @@ void SelectMachineDialog::set_default() //project name m_rename_switch_panel->SetSelection(0); - wxString filename = m_plater->get_export_gcode_filename("", true, m_print_plate_idx == PLATE_ALL_IDX ? true : false); + //y49 + wxString filename = m_plater->get_output_filename(); + if (m_print_plate_idx == PLATE_ALL_IDX && filename.empty()) { filename = _L("Untitled"); } diff --git a/src/slic3r/GUI/SendMultiMachinePage.cpp b/src/slic3r/GUI/SendMultiMachinePage.cpp index 3f1b1e5..a215f38 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.cpp +++ b/src/slic3r/GUI/SendMultiMachinePage.cpp @@ -1470,7 +1470,8 @@ void SendMultiMachinePage::set_default_normal(const ThumbnailData& data) void SendMultiMachinePage::set_default() { - wxString filename = m_plater->get_export_gcode_filename("", true, m_print_plate_idx == PLATE_ALL_IDX ? true : false); + //y49 + wxString filename = m_plater->get_output_filename(); if (m_print_plate_idx == PLATE_ALL_IDX && filename.empty()) { filename = _L("Untitled"); }