From 8b1bf130216254fb920435f9034dae926ad6c755 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Wed, 29 May 2024 23:03:47 +0800 Subject: [PATCH] optimize cross hatch infill to enchance strength (#5495) Optimize the cross-hatch infill pattern to improve strength when low infill density is used. --- src/libslic3r/Fill/FillCrossHatch.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Fill/FillCrossHatch.cpp b/src/libslic3r/Fill/FillCrossHatch.cpp index ebac74bf414..d62db0b4eae 100644 --- a/src/libslic3r/Fill/FillCrossHatch.cpp +++ b/src/libslic3r/Fill/FillCrossHatch.cpp @@ -1,6 +1,7 @@ #include "../ClipperUtils.hpp" #include "../ShortestPath.hpp" #include "../Surface.hpp" +#include #include "FillCrossHatch.hpp" @@ -193,7 +194,12 @@ void FillCrossHatch ::_fill_surface_single( bb.merge(align_to_grid(bb.min, Point(line_spacing * 4, line_spacing * 4))); // generate pattern - Polylines polylines = generate_infill_layers(scale_(this->z), 1, line_spacing, bb.size()(0), bb.size()(1)); + //Orca: optimize the cross-hatch infill pattern to improve strength when low infill density is used. + double repeat_ratio = 1.0; + if (params.density < 0.3) + repeat_ratio = std::clamp(1.0 - std::exp(-5 * params.density), 0.2, 1.0); + + Polylines polylines = generate_infill_layers(scale_(this->z), repeat_ratio, line_spacing, bb.size()(0), bb.size()(1)); // shift the pattern to the actual space for (Polyline &pl : polylines) { pl.translate(bb.min); }