Skip to content

Commit

Permalink
Merge PR "Aligned Monotonic infill for improving surface finish and c…
Browse files Browse the repository at this point in the history
…larity of clear parts" prusa3d#10847
  • Loading branch information
scottmudge authored and vovodroid committed Jun 7, 2024
1 parent ca50af3 commit 6832d1c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/libslic3r/Fill/FillBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Fill* Fill::new_from_type(const InfillPattern type)
case ipAlignedRectilinear: return new FillAlignedRectilinear();
case ipMonotonic: return new FillMonotonic();
case ipMonotonicLines: return new FillMonotonicLines();
case ipAlignedMonotonic: return new FillAlignedMonotonic();
case ipLine: return new FillLine();
case ipGrid: return new FillGrid();
case ipTriangles: return new FillTriangles();
Expand Down
10 changes: 10 additions & 0 deletions src/libslic3r/Fill/FillRectilinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2983,6 +2983,16 @@ Polylines FillMonotonic::fill_surface(const Surface *surface, const FillParams &
return polylines_out;
}

Polylines FillAlignedMonotonic::fill_surface(const Surface *surface, const FillParams &params)
{
FillParams params2 = params;
params2.monotonic = true;
Polylines polylines_out;
if (! fill_surface_by_lines(surface, params2, 0.f, 0.f, polylines_out))
BOOST_LOG_TRIVIAL(error) << "FillAlignedMonotonic::fill_surface() failed to fill a region.";
return polylines_out;
}

Polylines FillMonotonicLines::fill_surface(const Surface *surface, const FillParams &params)
{
FillParams params2 = params;
Expand Down
13 changes: 13 additions & 0 deletions src/libslic3r/Fill/FillRectilinear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ class FillMonotonicLines : public FillRectilinear
bool no_sort() const override { return true; }
};

class FillAlignedMonotonic : public FillRectilinear
{
public:
Fill* clone() const override { return new FillAlignedMonotonic(*this); }
~FillAlignedMonotonic() override = default;
Polylines fill_surface(const Surface *surface, const FillParams &params) override;
bool no_sort() const override { return true; }

protected:
// Always generate infill at the same angle.
virtual float _layer_angle(size_t idx) const override { return 0.f; }
};

class FillGrid : public FillRectilinear
{
public:
Expand Down
4 changes: 4 additions & 0 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ static const t_config_enum_values s_keys_map_InfillPattern {
{ "monotonic", ipMonotonic },
{ "monotoniclines", ipMonotonicLines },
{ "alignedrectilinear", ipAlignedRectilinear },
{ "alignedmonotonic", ipAlignedMonotonic },
{ "grid", ipGrid },
{ "triangles", ipTriangles },
{ "stars", ipStars },
Expand Down Expand Up @@ -953,6 +954,7 @@ void PrintConfigDef::init_fff_params()
{ "monotonic", L("Monotonic") },
{ "monotoniclines", L("Monotonic Lines") },
{ "alignedrectilinear", L("Aligned Rectilinear") },
{ "alignedmonotonic", L("Aligned Monotonic") },
{ "concentric", L("Concentric") },
{ "hilbertcurve", L("Hilbert Curve") },
{ "archimedeanchords", L("Archimedean Chords") },
Expand Down Expand Up @@ -1484,6 +1486,8 @@ void PrintConfigDef::init_fff_params()
def->set_enum<InfillPattern>({
{ "rectilinear", L("Rectilinear") },
{ "alignedrectilinear", L("Aligned Rectilinear") },
{ "monotonic", L("Monotonic") },
{ "alignedmonotonic", L("Aligned Monotonic") },
{ "grid", L("Grid") },
{ "triangles", L("Triangles")},
{ "stars", L("Stars")},
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ enum class FuzzySkinType {
};

enum InfillPattern : int {
ipRectilinear, ipMonotonic, ipMonotonicLines, ipAlignedRectilinear, ipGrid, ipTriangles, ipStars, ipCubic, ipLine, ipConcentric, ipHoneycomb, ip3DHoneycomb,
ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic, ipSupportBase,
ipLightning,
ipRectilinear, ipMonotonic, ipMonotonicLines, ipAlignedRectilinear, ipAlignedMonotonic, ipGrid, ipTriangles, ipStars, ipCubic, ipLine,
ipConcentric, ipHoneycomb, ip3DHoneycomb, ipGyroid, ipHilbertCurve, ipArchimedeanChords, ipOctagramSpiral, ipAdaptiveCubic, ipSupportCubic,
ipSupportBase,ipLightning,
ipEnsuring,
ipCount,
ipAlterCentric
Expand Down

0 comments on commit 6832d1c

Please sign in to comment.