diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index ff29d7b561..b65c9ec994 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -2311,11 +2311,10 @@ std::pair(0, int(intermediate_layers.size())), - [this, &bottom_contacts, &top_contacts, &intermediate_layers, &insert_layer, num_interface_layers, num_interface_layers_only, - &interface_layers, &base_interface_layers](const tbb::blocked_range& range) { - - // gather the number of layers below/above object - // FIX The algorithm calculates top_z/bottom_z coordinates refered to the conctacts and above them polygons are projected. + [this, &bottom_contacts, &top_contacts, &intermediate_layers, &insert_layer, num_interface_layers, num_base_interface_layers, num_interface_layers_only, + &interface_layers, &base_interface_layers](const tbb::blocked_range& range) { + // Gather the top / bottom contact layers intersecting with num_interface_layers resp. num_interface_layers_only intermediate layers above / below + // this intermediate layer. // Index of the first top contact layer intersecting the current intermediate layer. auto idx_top_contact_first = -1; // Index of the first bottom contact layer intersecting the current intermediate layer. @@ -2324,11 +2323,20 @@ std::pairprint_z; - coordf_t top_inteface_z = intermediate_layers[std::min(num_intermediate - 1, idx_intermediate_layer + num_interface_layers_only - 1)]->print_z; + coordf_t top_inteface_z = std::numeric_limits::max(); coordf_t bottom_z = intermediate_layers[std::max(0, idx_intermediate_layer - num_interface_layers + 1)]->bottom_z; - coordf_t bottom_interface_z = intermediate_layers[std::max(0, idx_intermediate_layer - num_interface_layers_only + 1)]->bottom_z; + coordf_t bottom_interface_z = - std::numeric_limits::max(); + if (num_base_interface_layers > 0) { + // Some base interface layers will be generated. + if (num_interface_layers_only == 0) + // Only base interface layers to generate. + std::swap(top_inteface_z, bottom_interface_z); + else { + top_inteface_z = intermediate_layers[std::min(num_intermediate - 1, idx_intermediate_layer + num_interface_layers_only - 1)]->print_z; + bottom_interface_z = intermediate_layers[std::max(0, idx_intermediate_layer - num_interface_layers_only)]->bottom_z; + } + } // Move idx_top_contact_first up until above the current print_z. idx_top_contact_first = idx_higher_or_equal(top_contacts, idx_top_contact_first, [&intermediate_layer](const MyLayer *layer){ return layer->print_z >= intermediate_layer.print_z; }); // - EPSILON // Collect the top contact areas above this intermediate layer, below top_z. @@ -2336,7 +2344,7 @@ std::pair top_z) break; polygons_append(top_contact_layer.bottom_z - EPSILON > top_inteface_z ? polygons_top_contact_projected_base : polygons_top_contact_projected_interface, top_contact_layer.polygons); diff --git a/src/libslic3r/SupportMaterial.hpp b/src/libslic3r/SupportMaterial.hpp index d26bcf70bf..030d2219a9 100644 --- a/src/libslic3r/SupportMaterial.hpp +++ b/src/libslic3r/SupportMaterial.hpp @@ -201,10 +201,9 @@ private: const MyLayersPtr &base_layers, MyLayerStorage &layer_storage) const; - // New method allows base interface support, also - // Turn some of the base layers into interface layers for number_base_interface_layers == 0. - // Create base type interface layers under soluble interfaces to extend adhesion. - // Turn some of the base layers into base interface layers for number_base_interface_layers > 0. + // Turn some of the base layers into base interface layers. + // For soluble interfaces with non-soluble bases, print maximum two first interface layers with the base + // extruder to improve adhesion of the soluble filament to the base. std::pair generate_interface_layers( const MyLayersPtr &bottom_contacts, const MyLayersPtr &top_contacts, @@ -226,7 +225,6 @@ private: void clip_with_shape(); */ - // New method needed for additional base interface support // Produce the actual G-code. void generate_toolpaths( SupportLayerPtrs &support_layers, @@ -252,7 +250,7 @@ private: bool m_can_merge_support_regions; coordf_t m_support_layer_height_min; - coordf_t m_support_layer_height_max; +// coordf_t m_support_layer_height_max; coordf_t m_gap_xy; };