Skip to content

Commit

Permalink
optimize cross hatch infill to enchance strength (#5495)
Browse files Browse the repository at this point in the history
Optimize the cross-hatch infill pattern to improve strength when low infill density is used.
  • Loading branch information
SoftFever authored May 29, 2024
1 parent c14ae13 commit 8b1bf13
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/libslic3r/Fill/FillCrossHatch.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "../ClipperUtils.hpp"
#include "../ShortestPath.hpp"
#include "../Surface.hpp"
#include <cmath>

#include "FillCrossHatch.hpp"

Expand Down Expand Up @@ -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); }
Expand Down

0 comments on commit 8b1bf13

Please sign in to comment.