diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index 57179471fd2..a6b2798aa31 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -3653,9 +3653,11 @@ FillWithPerimeter::fill_surface_extrusion(const Surface* surface, const FillPara // === extrude perimeter & associated surface at the same time, in the right order === //generate perimeter: - ExPolygons path_perimeter = offset2_ex(ExPolygons{ surface->expolygon }, - scale_d(-this->get_spacing()), scale_d(this->get_spacing() / 2), - ClipperLib::jtMiter, scale_d(this->get_spacing()) * 10); + coord_t offset_for_overlap = scale_d(this->get_spacing() / 2) * ((1 - overlap_ratio) / 2); + ExPolygons path_perimeter = offset2_ex(ExPolygons{surface->expolygon}, + scale_d(-this->get_spacing()) / 2 - offset_for_overlap, + offset_for_overlap, + ClipperLib::jtMiter, scale_d(this->get_spacing()) * 10); //fix a bug that can happens when (positive) offsetting with a big miter limit and two island merge. See https://github.com/supermerill/SuperSlicer/issues/609 path_perimeter = intersection_ex(path_perimeter, offset_ex(surface->expolygon, scale_d(-this->get_spacing() / 2))); for (ExPolygon& expolygon : path_perimeter) { diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index 9d37d1c3286..cdcfb3d8f51 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -241,6 +241,8 @@ namespace NaiveConnect { class FillWithPerimeter : public Fill { public: + // bewteen 0 (0%) and 1 (100%) overlap + float overlap_ratio = 0; std::unique_ptr infill{ nullptr }; float ratio_fill_inside = 0.f; FillWithPerimeter() : Fill() {} diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index f947923285a..b90670dc09b 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -19,7 +19,7 @@ #include #include #include - +#pragma optimize("", off) #define SUPPORT_USE_AGG_RASTERIZER #ifdef SUPPORT_USE_AGG_RASTERIZER @@ -3912,10 +3912,10 @@ void modulate_extrusion_by_overlapping_layers( const PrintObjectSupportMaterial::MyLayer &overlapping_layer = *overlapping_layers[i_overlapping_layer]; bbox.merge(get_extents(overlapping_layer.polygons)); } - for (ExtrusionEntitiesPtr::const_iterator it = extrusions_in_out.begin(); it != extrusions_in_out.end(); ++ it) { + for (ExtrusionEntitiesPtr::const_iterator it = extrusions_in_out.set_entities().begin(); it != extrusions_in_out.set_entities().end(); ++ it) { ExtrusionPath *path = dynamic_cast(*it); assert(path != nullptr); - bbox.merge(get_extents(path->polyline)); + bbox.merge(get_extents(path->polyline.as_polyline())); } SVG svg(debug_out_path("support-fragments-%d-%lf.svg", iRun, this_layer.print_z).c_str(), bbox); const float transparency = 0.5f; @@ -3932,10 +3932,10 @@ void modulate_extrusion_by_overlapping_layers( svg.draw(to_polylines(overlapping_layer.polygons), dbg_index_to_color(int(i_overlapping_layer)), scale_(0.1)); } // Fill extrusion, the source. - for (ExtrusionEntitiesPtr::const_iterator it = extrusions_in_out.begin(); it != extrusions_in_out.end(); ++ it) { + for (ExtrusionEntitiesPtr::const_iterator it = extrusions_in_out.set_entities().begin(); it != extrusions_in_out.set_entities().end(); ++ it) { ExtrusionPath *path = dynamic_cast(*it); std::string color_name; - switch ((it - extrusions_in_out.begin()) % 9) { + switch ((it - extrusions_in_out.set_entities().begin()) % 9) { case 0: color_name = "magenta"; break; case 1: color_name = "deepskyblue"; break; case 2: color_name = "coral"; break; @@ -3946,7 +3946,7 @@ void modulate_extrusion_by_overlapping_layers( case 7: color_name = "brown"; break; default: color_name = "orchid"; break; } - svg.draw(path->polyline, color_name, scale_(0.2)); + svg.draw(path->polyline.as_polyline(), color_name, scale_(0.2)); } #endif /* SLIC3R_DEBUG */ @@ -4171,8 +4171,10 @@ void PrintObjectSupportMaterial::generate_toolpaths( std::unique_ptr filler_interface = std::unique_ptr(Fill::new_from_type(m_support_params.contact_fill_pattern)); //m_support_params.interface_fill_pattern)); FIXME choose std::unique_ptr filler_support = std::unique_ptr(Fill::new_from_type(m_support_params.base_fill_pattern)); std::unique_ptr filler_support_with_sheath = std::make_unique((Fill::new_from_type(m_support_params.base_fill_pattern))); + filler_support_with_sheath->overlap = m_support_params.gap_xy == 0 ? 0 : 1; // allow periemter overlap is not touching perimeters filler_support_with_sheath->ratio_fill_inside = 0.2f; std::unique_ptr filler_dense = std::make_unique((Fill::new_from_type(ipRectilinear))); + filler_dense->overlap = m_support_params.gap_xy == 0 ? 0 : 1; filler_dense->ratio_fill_inside = 0.2f; filler_interface->set_bounding_box(bbox_object); filler_support->set_bounding_box(bbox_object); @@ -4489,7 +4491,7 @@ void PrintObjectSupportMaterial::generate_toolpaths( // Destination base_layer.extrusions.set_entities(), // Regions to fill - closing_ex(base_layer.polygons_to_extrude(), float(SCALED_EPSILON), float(SCALED_EPSILON + 0.5 * flow.scaled_width())), + closing_ex(base_layer.polygons_to_extrude(), float(SCALED_EPSILON), float(SCALED_EPSILON)), // Filler and its parameters filler, density, // Extrusion parameters diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index 4dd7a6b9758..f6f52235459 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -632,9 +632,15 @@ wxBoxSizer* Preview::create_layers_slider_sizer() Bind(DoubleSlider::wxCUSTOMEVT_TICKSCHANGED, [this](wxEvent&) { Model& model = wxGetApp().plater()->model(); Info custom_gcode_per_print_z = m_layers_slider->GetTicksValues(); + auto num_of_old_gcodes = model.custom_gcode_per_print_z.gcodes.size(); model.custom_gcode_per_print_z = custom_gcode_per_print_z; - m_schedule_background_process(); + std::string operation_message = (num_of_old_gcodes == model.custom_gcode_per_print_z.gcodes.size()) ? "Edit" : + (num_of_old_gcodes < model.custom_gcode_per_print_z.gcodes.size()) ? "Add" : + "Remove"; + m_schedule_background_process(); + wxGetApp().plater()->take_snapshot(from_u8( + (boost::format(_utf8(L("Change layer gcode: %s element"))) % operation_message).str())); m_keep_current_preview_type = false; reload_print(false); });