From 1133c7119075f0dc427e4b5a10c4687af44dc24d Mon Sep 17 00:00:00 2001 From: igiannakas <59056762+igiannakas@users.noreply.github.com> Date: Sun, 17 Sep 2023 18:11:33 +0300 Subject: [PATCH] Pressure equaliser layer result update --- src/libslic3r/GCode.cpp | 28 ++++++++++++++-------------- src/libslic3r/GCode.hpp | 10 +--------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 9f563a94fb..30ae1312f0 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2596,8 +2596,8 @@ void GCode::process_layers( { // The pipeline is variable: The vase mode filter is optional. size_t layer_to_print_idx = 0; - const auto generator = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, - [this, &print, &tool_ordering, &print_object_instances_ordering, &layers_to_print, &layer_to_print_idx](tbb::flow_control& fc) -> GCode::LayerResult { + const auto generator = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, + [this, &print, &tool_ordering, &print_object_instances_ordering, &layers_to_print, &layer_to_print_idx](tbb::flow_control& fc) -> LayerResult { if (layer_to_print_idx >= layers_to_print.size()) { if ((!m_pressure_equalizer && layer_to_print_idx == layers_to_print.size()) || (m_pressure_equalizer && layer_to_print_idx == (layers_to_print.size() + 1))) { fc.stop(); @@ -2624,8 +2624,8 @@ void GCode::process_layers( } }); - const auto spiral_mode = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, - [&spiral_mode = *this->m_spiral_vase.get()](GCode::LayerResult in) -> GCode::LayerResult { + const auto spiral_mode = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, + [&spiral_mode = *this->m_spiral_vase.get()](LayerResult in) -> LayerResult { spiral_mode.enable(in.spiral_vase_enable); return { spiral_mode.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush }; }); @@ -2633,8 +2633,8 @@ void GCode::process_layers( [pressure_equalizer = this->m_pressure_equalizer.get()](LayerResult in) -> LayerResult { return pressure_equalizer->process_layer(std::move(in)); }); - const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, - [&cooling_buffer = *this->m_cooling_buffer.get()](GCode::LayerResult in) -> std::string { + const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, + [&cooling_buffer = *this->m_cooling_buffer.get()](LayerResult in) -> std::string { return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush); }); const auto output = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, @@ -2681,8 +2681,8 @@ void GCode::process_layers( { // The pipeline is variable: The vase mode filter is optional. size_t layer_to_print_idx = 0; - const auto generator = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, - [this, &print, &tool_ordering, &layers_to_print, &layer_to_print_idx, single_object_idx, prime_extruder](tbb::flow_control& fc) -> GCode::LayerResult { + const auto generator = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, + [this, &print, &tool_ordering, &layers_to_print, &layer_to_print_idx, single_object_idx, prime_extruder](tbb::flow_control& fc) -> LayerResult { if (layer_to_print_idx == layers_to_print.size()) { fc.stop(); return {}; @@ -2695,13 +2695,13 @@ void GCode::process_layers( return this->process_layer(print, { std::move(layer) }, tool_ordering.tools_for_layer(layer.print_z()), &layer == &layers_to_print.back(), nullptr, single_object_idx, prime_extruder); } }); - const auto spiral_mode = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, - [&spiral_mode = *this->m_spiral_vase.get()](GCode::LayerResult in)->GCode::LayerResult { + const auto spiral_mode = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, + [&spiral_mode = *this->m_spiral_vase.get()](LayerResult in)->LayerResult { spiral_mode.enable(in.spiral_vase_enable); return { spiral_mode.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush }; }); - const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, - [&cooling_buffer = *this->m_cooling_buffer.get()](GCode::LayerResult in)->std::string { + const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, + [&cooling_buffer = *this->m_cooling_buffer.get()](LayerResult in)->std::string { return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush); }); const auto output = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, @@ -3232,7 +3232,7 @@ inline std::string get_instance_name(const PrintObject *object, const PrintInsta // In non-sequential mode, process_layer is called per each print_z height with all object and support layers accumulated. // For multi-material prints, this routine minimizes extruder switches by gathering extruder specific extrusion paths // and performing the extruder specific extrusions together. -GCode::LayerResult GCode::process_layer( +LayerResult GCode::process_layer( const Print &print, // Set of object & print layers of the same PrintObject and with the same print_z. const std::vector &layers, @@ -3271,7 +3271,7 @@ GCode::LayerResult GCode::process_layer( else if (support_layer != nullptr) layer_ptr = support_layer; const Layer& layer = *layer_ptr; - GCode::LayerResult result { {}, layer.id(), false, last_layer }; + LayerResult result { {}, layer.id(), false, last_layer }; if (layer_tools.extruders.empty()) // Nothing to extrude. return result; diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index 32db000ae3..8efd6dcc0e 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -147,7 +147,7 @@ struct LayerResult { bool spiral_vase_enable { false }; // Should the cooling buffer content be flushed at the end of this layer? bool cooling_buffer_flush { false }; - // Is indicating if this LayerResult should be processed, or it is just inserted artificial LayerResult. + // Is indicating if this LayerResult should be processed, or it is just inserted artificial LayerResult. // It is used for the pressure equalizer because it needs to buffer one layer back. bool nop_layer_result { false }; @@ -301,14 +301,6 @@ private: static std::vector collect_layers_to_print(const PrintObject &object); static std::vector>> collect_layers_to_print(const Print &print); - struct LayerResult { - std::string gcode; - size_t layer_id; - // Is spiral vase post processing enabled for this layer? - bool spiral_vase_enable { false }; - // Should the cooling buffer content be flushed at the end of this layer? - bool cooling_buffer_flush { false }; - }; LayerResult process_layer( const Print &print, // Set of object & print layers of the same PrintObject and with the same print_z.