Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/libslic3r/Fill/FillBase.hpp')
-rw-r--r--src/libslic3r/Fill/FillBase.hpp47
1 files changed, 33 insertions, 14 deletions
diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp
index 517ce8383..c09b70bca 100644
--- a/src/libslic3r/Fill/FillBase.hpp
+++ b/src/libslic3r/Fill/FillBase.hpp
@@ -5,42 +5,55 @@
#include <memory.h>
#include <float.h>
#include <stdint.h>
+#include <stdexcept>
#include <type_traits>
#include "../libslic3r.h"
#include "../BoundingBox.hpp"
-#include "../PrintConfig.hpp"
+#include "../Exception.hpp"
#include "../Utils.hpp"
namespace Slic3r {
class ExPolygon;
class Surface;
+enum InfillPattern : int;
+
+namespace FillAdaptive {
+ struct Octree;
+};
+
+// Infill shall never fail, therefore the error is classified as RuntimeError, not SlicingError.
+class InfillFailedException : public Slic3r::RuntimeError {
+public:
+ InfillFailedException() : Slic3r::RuntimeError("Infill failed") {}
+};
struct FillParams
{
- FillParams() {
- memset(this, 0, sizeof(FillParams));
- // Adjustment does not work.
- dont_adjust = true;
- }
-
bool full_infill() const { return density > 0.9999f; }
+ // Don't connect the fill lines around the inner perimeter.
+ bool dont_connect() const { return anchor_length_max < 0.05f; }
// Fill density, fraction in <0, 1>
- float density;
+ float density { 0.f };
- // Don't connect the fill lines around the inner perimeter.
- bool dont_connect;
+ // Length of an infill anchor along the perimeter.
+ // 1000mm is roughly the maximum length line that fits into a 32bit coord_t.
+ float anchor_length { 1000.f };
+ float anchor_length_max { 1000.f };
// Don't adjust spacing to fill the space evenly.
- bool dont_adjust;
+ bool dont_adjust { true };
+
+ // Monotonic infill - strictly left to right for better surface quality of top infills.
+ bool monotonic { false };
// For Honeycomb.
// we were requested to complete each loop;
// in this case we don't try to make more continuous paths
- bool complete;
+ bool complete { false };
};
static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
@@ -66,8 +79,12 @@ public:
// In scaled coordinates. Bounding box of the 2D projection of the object.
BoundingBox bounding_box;
+ // Octree builds on mesh for usage in the adaptive cubic infill
+ FillAdaptive::Octree* adapt_fill_octree = nullptr;
+
public:
virtual ~Fill() {}
+ virtual Fill* clone() const = 0;
static Fill* new_from_type(const InfillPattern type);
static Fill* new_from_type(const std::string &type);
@@ -104,7 +121,7 @@ protected:
const FillParams & /* params */,
unsigned int /* thickness_layers */,
const std::pair<float, Point> & /* direction */,
- ExPolygon & /* expolygon */,
+ ExPolygon /* expolygon */,
Polylines & /* polylines_out */) {};
virtual float _layer_angle(size_t idx) const { return (idx & 1) ? float(M_PI/2.) : 0; }
@@ -112,7 +129,9 @@ protected:
virtual std::pair<float, Point> _infill_direction(const Surface *surface) const;
public:
- static void connect_infill(Polylines &&infill_ordered, const ExPolygon &boundary, Polylines &polylines_out, double spacing, const FillParams &params);
+ static void connect_infill(Polylines &&infill_ordered, const ExPolygon &boundary, Polylines &polylines_out, const double spacing, const FillParams &params);
+ static void connect_infill(Polylines &&infill_ordered, const Polygons &boundary, const BoundingBox& bbox, Polylines &polylines_out, const double spacing, const FillParams &params);
+ static void connect_infill(Polylines &&infill_ordered, const std::vector<const Polygon*> &boundary, const BoundingBox &bbox, Polylines &polylines_out, double spacing, const FillParams &params);
static coord_t _adjust_solid_spacing(const coord_t width, const coord_t distance);