Automatically switch to rectilinear when a pattern is used that doesn't support solid infill

This commit is contained in:
Alessandro Ranellucci 2017-01-11 18:55:48 +01:00
parent ee2d14fcd2
commit 182d68ad85
4 changed files with 19 additions and 0 deletions

View File

@ -75,6 +75,9 @@ public:
// Do not sort the fill lines to optimize the print head path? // Do not sort the fill lines to optimize the print head path?
virtual bool no_sort() const { return false; }; virtual bool no_sort() const { return false; };
// Can this pattern be used for solid infill?
virtual bool can_solid() const { return false; };
// Perform the fill. // Perform the fill.
virtual Polylines fill_surface(const Surface &surface); virtual Polylines fill_surface(const Surface &surface);

View File

@ -19,6 +19,7 @@ protected:
Polylines* polylines_out); Polylines* polylines_out);
virtual bool no_sort() const { return true; } virtual bool no_sort() const { return true; }
virtual bool can_solid() const { return true; };
}; };
} // namespace Slic3r } // namespace Slic3r

View File

@ -12,6 +12,7 @@ class FillRectilinear : public Fill
public: public:
virtual Fill* clone() const { return new FillRectilinear(*this); }; virtual Fill* clone() const { return new FillRectilinear(*this); };
virtual ~FillRectilinear() {} virtual ~FillRectilinear() {}
virtual bool can_solid() const { return true; };
protected: protected:
virtual void _fill_surface_single( virtual void _fill_surface_single(
@ -50,6 +51,7 @@ class FillAlignedRectilinear : public FillRectilinear
public: public:
virtual Fill* clone() const { return new FillAlignedRectilinear(*this); }; virtual Fill* clone() const { return new FillAlignedRectilinear(*this); };
virtual ~FillAlignedRectilinear() {}; virtual ~FillAlignedRectilinear() {};
virtual bool can_solid() const { return false; };
protected: protected:
// Keep the angle constant in all layers. // Keep the angle constant in all layers.
@ -61,6 +63,7 @@ class FillGrid : public FillRectilinear
public: public:
virtual Fill* clone() const { return new FillGrid(*this); }; virtual Fill* clone() const { return new FillGrid(*this); };
virtual ~FillGrid() {} virtual ~FillGrid() {}
virtual bool can_solid() const { return false; };
protected: protected:
// The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill. // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
@ -78,6 +81,7 @@ class FillTriangles : public FillRectilinear
public: public:
virtual Fill* clone() const { return new FillTriangles(*this); }; virtual Fill* clone() const { return new FillTriangles(*this); };
virtual ~FillTriangles() {} virtual ~FillTriangles() {}
virtual bool can_solid() const { return false; };
protected: protected:
// The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill. // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
@ -95,6 +99,7 @@ class FillStars : public FillRectilinear
public: public:
virtual Fill* clone() const { return new FillStars(*this); }; virtual Fill* clone() const { return new FillStars(*this); };
virtual ~FillStars() {} virtual ~FillStars() {}
virtual bool can_solid() const { return false; };
protected: protected:
// The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill. // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.
@ -112,6 +117,7 @@ class FillCubic : public FillRectilinear
public: public:
virtual Fill* clone() const { return new FillCubic(*this); }; virtual Fill* clone() const { return new FillCubic(*this); };
virtual ~FillCubic() {} virtual ~FillCubic() {}
virtual bool can_solid() const { return false; };
protected: protected:
// The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill. // The grid fill will keep the angle constant between the layers,; see the implementation of Slic3r::Fill.

View File

@ -183,6 +183,15 @@ LayerRegion::make_fill()
#else #else
std::auto_ptr<Fill> f = std::auto_ptr<Fill>(Fill::new_from_type(fill_pattern)); std::auto_ptr<Fill> f = std::auto_ptr<Fill>(Fill::new_from_type(fill_pattern));
#endif #endif
// switch to rectilinear if this pattern doesn't support solid infill
if (density > 0.9999f && !f->can_solid())
#if SLIC3R_CPPVER >= 11
f = std::unique_ptr<Fill>(Fill::new_from_type(ipRectilinear));
#else
f = std::auto_ptr<Fill>(Fill::new_from_type(ipRectilinear));
#endif
f->bounding_box = this->layer()->object()->bounding_box(); f->bounding_box = this->layer()->object()->bounding_box();
// calculate the actual flow we'll be using for this infill // calculate the actual flow we'll be using for this infill