mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-15 05:41:48 +08:00
ironing: cleaning code (remove duplication), streamline arguments & config struct for fill_surface_extrusion.
This commit is contained in:
parent
7d4f090786
commit
fb0fe3ac39
@ -304,7 +304,8 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
|||||||
//params.flow_mult = layerm.region()->config().over_bridge_flow_ratio;
|
//params.flow_mult = layerm.region()->config().over_bridge_flow_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->fill_surface_extrusion(&surface, params, flow, erNone, out.entities);
|
params.flow = &flow;
|
||||||
|
f->fill_surface_extrusion(&surface, params, out.entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add thin fill regions
|
// add thin fill regions
|
||||||
|
@ -138,14 +138,14 @@ std::pair<float, Point> Fill::_infill_direction(const Surface *surface) const
|
|||||||
return std::pair<float, Point>(out_angle, out_shift);
|
return std::pair<float, Point>(out_angle, out_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out) {
|
void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out) {
|
||||||
//add overlap & call fill_surface
|
//add overlap & call fill_surface
|
||||||
Polylines polylines = this->fill_surface(surface, params);
|
Polylines polylines = this->fill_surface(surface, params);
|
||||||
if (polylines.empty())
|
if (polylines.empty())
|
||||||
return;
|
return;
|
||||||
// ensure it doesn't over or under-extrude
|
// ensure it doesn't over or under-extrude
|
||||||
double multFlow = 1;
|
double multFlow = 1;
|
||||||
if (!params.dont_adjust && params.full_infill() && !flow.bridge && params.fill_exactly){
|
if (!params.dont_adjust && params.full_infill() && !params.flow->bridge && params.fill_exactly){
|
||||||
// compute the path of the nozzle -> extruded volume
|
// compute the path of the nozzle -> extruded volume
|
||||||
double lengthTot = 0;
|
double lengthTot = 0;
|
||||||
int nbLines = 0;
|
int nbLines = 0;
|
||||||
@ -156,17 +156,17 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶
|
|||||||
nbLines++;
|
nbLines++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double extrudedVolume = flow.mm3_per_mm() * lengthTot;
|
double extrudedVolume = params.flow->mm3_per_mm() * lengthTot;
|
||||||
// compute real volume
|
// compute real volume
|
||||||
double poylineVolume = 0;
|
double poylineVolume = 0;
|
||||||
for (auto poly = this->no_overlap_expolygons.begin(); poly != this->no_overlap_expolygons.end(); ++poly) {
|
for (auto poly = this->no_overlap_expolygons.begin(); poly != this->no_overlap_expolygons.end(); ++poly) {
|
||||||
poylineVolume += flow.height*unscaled(unscaled(poly->area()));
|
poylineVolume += params.flow->height*unscaled(unscaled(poly->area()));
|
||||||
// add external "perimeter gap"
|
// add external "perimeter gap"
|
||||||
double perimeterRoundGap = unscaled(poly->contour.length()) * flow.height * (1 - 0.25*PI) * 0.5;
|
double perimeterRoundGap = unscaled(poly->contour.length()) * params.flow->height * (1 - 0.25*PI) * 0.5;
|
||||||
// add holes "perimeter gaps"
|
// add holes "perimeter gaps"
|
||||||
double holesGaps = 0;
|
double holesGaps = 0;
|
||||||
for (auto hole = poly->holes.begin(); hole != poly->holes.end(); ++hole) {
|
for (auto hole = poly->holes.begin(); hole != poly->holes.end(); ++hole) {
|
||||||
holesGaps += unscaled(hole->length()) * flow.height * (1 - 0.25*PI) * 0.5;
|
holesGaps += unscaled(hole->length()) * params.flow->height * (1 - 0.25*PI) * 0.5;
|
||||||
}
|
}
|
||||||
poylineVolume += perimeterRoundGap + holesGaps;
|
poylineVolume += perimeterRoundGap + holesGaps;
|
||||||
}
|
}
|
||||||
@ -188,9 +188,9 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶
|
|||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
out.push_back(eec);
|
out.push_back(eec);
|
||||||
//get the role
|
//get the role
|
||||||
ExtrusionRole good_role = role;
|
ExtrusionRole good_role = params.role;
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
good_role = (flow.bridge ? erBridgeInfill :
|
good_role = (params.flow->bridge ? erBridgeInfill :
|
||||||
(surface->is_solid() ?
|
(surface->is_solid() ?
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
erInternalInfill));
|
erInternalInfill));
|
||||||
@ -199,9 +199,9 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶
|
|||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, std::move(polylines),
|
eec->entities, std::move(polylines),
|
||||||
good_role,
|
good_role,
|
||||||
flow.mm3_per_mm() * params.flow_mult * multFlow,
|
params.flow->mm3_per_mm() * params.flow_mult * multFlow,
|
||||||
flow.width * params.flow_mult * multFlow,
|
params.flow->width * params.flow_mult * multFlow,
|
||||||
flow.height);
|
params.flow->height);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ struct FillParams
|
|||||||
dont_adjust = true;
|
dont_adjust = true;
|
||||||
flow_mult = 1.f;
|
flow_mult = 1.f;
|
||||||
fill_exactly = false;
|
fill_exactly = false;
|
||||||
|
role = erNone;
|
||||||
|
flow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool full_infill() const { return density > 0.9999f && density < 1.0001f; }
|
bool full_infill() const { return density > 0.9999f && density < 1.0001f; }
|
||||||
@ -49,6 +51,12 @@ struct FillParams
|
|||||||
// we were requested to complete each loop;
|
// we were requested to complete each loop;
|
||||||
// in this case we don't try to make more continuous paths
|
// in this case we don't try to make more continuous paths
|
||||||
bool complete;
|
bool complete;
|
||||||
|
|
||||||
|
// if role == erNone or ERCustom, this method have to choose the best role itself, else it must use the argument's role.
|
||||||
|
ExtrusionRole role;
|
||||||
|
|
||||||
|
//flow to use
|
||||||
|
Flow const *flow;
|
||||||
};
|
};
|
||||||
static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
|
static_assert(IsTriviallyCopyable<FillParams>::value, "FillParams class is not POD (and it should be - see constructor).");
|
||||||
|
|
||||||
@ -90,9 +98,7 @@ public:
|
|||||||
virtual bool no_sort() const { return false; }
|
virtual bool no_sort() const { return false; }
|
||||||
|
|
||||||
// This method have to fill the ExtrusionEntityCollection. It call fill_surface by default
|
// This method have to fill the ExtrusionEntityCollection. It call fill_surface by default
|
||||||
// if role == erNone or ERCustom, this method have to choose the best role itself, else it must use the argument's role.
|
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out);
|
||||||
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out);
|
|
||||||
|
|
||||||
// Perform the fill.
|
// Perform the fill.
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
||||||
|
@ -65,7 +65,7 @@ void FillConcentric::_fill_surface_single(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FillConcentricWGapFill::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
void FillConcentricWGapFill::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out) {
|
ExtrusionEntitiesPtr &out) {
|
||||||
|
|
||||||
// Perform offset.
|
// Perform offset.
|
||||||
Slic3r::ExPolygons expp = offset_ex(surface->expolygon, float(scale_(0 - 0.5 * this->spacing)));
|
Slic3r::ExPolygons expp = offset_ex(surface->expolygon, float(scale_(0 - 0.5 * this->spacing)));
|
||||||
@ -112,9 +112,9 @@ void FillConcentricWGapFill::fill_surface_extrusion(const Surface *surface, cons
|
|||||||
|
|
||||||
|
|
||||||
//get the role
|
//get the role
|
||||||
ExtrusionRole good_role = role;
|
ExtrusionRole good_role = params.role;
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
good_role = (flow.bridge ? erBridgeInfill :
|
good_role = (params.flow->bridge ? erBridgeInfill :
|
||||||
(surface->is_solid() ?
|
(surface->is_solid() ?
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
erInternalInfill));
|
erInternalInfill));
|
||||||
@ -125,9 +125,9 @@ void FillConcentricWGapFill::fill_surface_extrusion(const Surface *surface, cons
|
|||||||
extrusion_entities_append_loops(
|
extrusion_entities_append_loops(
|
||||||
coll_nosort->entities, loops,
|
coll_nosort->entities, loops,
|
||||||
good_role,
|
good_role,
|
||||||
flow.mm3_per_mm() * params.flow_mult,
|
params.flow->mm3_per_mm() * params.flow_mult,
|
||||||
flow.width * params.flow_mult,
|
params.flow->width * params.flow_mult,
|
||||||
flow.height);
|
params.flow->height);
|
||||||
|
|
||||||
//add gapfills
|
//add gapfills
|
||||||
if (!gaps.empty() && params.density >= 1) {
|
if (!gaps.empty() && params.density >= 1) {
|
||||||
@ -143,11 +143,11 @@ void FillConcentricWGapFill::fill_surface_extrusion(const Surface *surface, cons
|
|||||||
//remove too small gaps that are too hard to fill.
|
//remove too small gaps that are too hard to fill.
|
||||||
//ie one that are smaller than an extrusion with width of min and a length of max.
|
//ie one that are smaller than an extrusion with width of min and a length of max.
|
||||||
if (ex.area() > min*max) {
|
if (ex.area() > min*max) {
|
||||||
ex.medial_axis(ex, max, min, &polylines, flow.height);
|
ex.medial_axis(ex, max, min, &polylines, params.flow->height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!polylines.empty()) {
|
if (!polylines.empty()) {
|
||||||
ExtrusionEntityCollection gap_fill = thin_variable_width(polylines, erGapFill, flow);
|
ExtrusionEntityCollection gap_fill = thin_variable_width(polylines, erGapFill, *params.flow);
|
||||||
coll_nosort->append(gap_fill.entities);
|
coll_nosort->append(gap_fill.entities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Fill* clone() const { return new FillConcentricWGapFill(*this); };
|
virtual Fill* clone() const { return new FillConcentricWGapFill(*this); };
|
||||||
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out) override;
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out);
|
|
||||||
|
|
||||||
virtual bool no_sort() const { return true; }
|
virtual bool no_sort() const { return true; }
|
||||||
};
|
};
|
||||||
|
@ -24,7 +24,7 @@ protected:
|
|||||||
unsigned int thickness_layers,
|
unsigned int thickness_layers,
|
||||||
const std::pair<float, Point> &direction,
|
const std::pair<float, Point> &direction,
|
||||||
ExPolygon &expolygon,
|
ExPolygon &expolygon,
|
||||||
Polylines &polylines_out);
|
Polylines &polylines_out) override;
|
||||||
|
|
||||||
virtual float _layer_angle(size_t idx) const { return 0.f; }
|
virtual float _layer_angle(size_t idx) const { return 0.f; }
|
||||||
virtual bool _centered() const = 0;
|
virtual bool _centered() const = 0;
|
||||||
|
@ -1491,8 +1491,7 @@ Polylines FillCubic::fill_surface(const Surface *surface, const FillParams ¶
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out)
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out)
|
|
||||||
{
|
{
|
||||||
ExtrusionEntityCollection *eecroot = new ExtrusionEntityCollection();
|
ExtrusionEntityCollection *eecroot = new ExtrusionEntityCollection();
|
||||||
//you don't want to sort the extrusions: big infill first, small second
|
//you don't want to sort the extrusions: big infill first, small second
|
||||||
@ -1519,9 +1518,9 @@ FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillP
|
|||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
//get the role
|
//get the role
|
||||||
ExtrusionRole good_role = role;
|
ExtrusionRole good_role = params.role;
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
good_role = flow.bridge ?
|
good_role = params.flow->bridge ?
|
||||||
erBridgeInfill :
|
erBridgeInfill :
|
||||||
(surface->is_solid() ?
|
(surface->is_solid() ?
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
@ -1532,9 +1531,9 @@ FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillP
|
|||||||
eec->entities,
|
eec->entities,
|
||||||
polylines_1,
|
polylines_1,
|
||||||
good_role,
|
good_role,
|
||||||
flow.mm3_per_mm() * params.flow_mult,
|
params.flow->mm3_per_mm() * params.flow_mult,
|
||||||
flow.width * params.flow_mult,
|
params.flow->width * params.flow_mult,
|
||||||
flow.height);
|
params.flow->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1558,9 +1557,9 @@ FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillP
|
|||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
//get the role
|
//get the role
|
||||||
ExtrusionRole good_role = role;
|
ExtrusionRole good_role = params.role;
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
good_role = flow.bridge ?
|
good_role = params.flow->bridge ?
|
||||||
erBridgeInfill :
|
erBridgeInfill :
|
||||||
(surface->is_solid() ?
|
(surface->is_solid() ?
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
@ -1571,9 +1570,9 @@ FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillP
|
|||||||
eec->entities,
|
eec->entities,
|
||||||
polylines_2,
|
polylines_2,
|
||||||
good_role,
|
good_role,
|
||||||
flow.mm3_per_mm() * params.flow_mult,
|
params.flow->mm3_per_mm() * params.flow_mult,
|
||||||
flow.width * params.flow_mult,
|
params.flow->width * params.flow_mult,
|
||||||
flow.height);
|
params.flow->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// === end ===
|
// === end ===
|
||||||
|
@ -16,7 +16,7 @@ class FillRectilinear2 : public Fill
|
|||||||
public:
|
public:
|
||||||
virtual Fill* clone() const { return new FillRectilinear2(*this); };
|
virtual Fill* clone() const { return new FillRectilinear2(*this); };
|
||||||
virtual ~FillRectilinear2() {}
|
virtual ~FillRectilinear2() {}
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::vector<SegmentedIntersectionLine> _vert_lines_for_polygon(const ExPolygonWithOffset &poly_with_offset, const BoundingBox &bounding_box, const FillParams ¶ms, coord_t line_spacing) const;
|
virtual std::vector<SegmentedIntersectionLine> _vert_lines_for_polygon(const ExPolygonWithOffset &poly_with_offset, const BoundingBox &bounding_box, const FillParams ¶ms, coord_t line_spacing) const;
|
||||||
@ -30,7 +30,7 @@ class FillGrid2 : public FillRectilinear2
|
|||||||
public:
|
public:
|
||||||
virtual Fill* clone() const { return new FillGrid2(*this); };
|
virtual Fill* clone() const { return new FillGrid2(*this); };
|
||||||
virtual ~FillGrid2() {}
|
virtual ~FillGrid2() {}
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
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.
|
||||||
@ -42,7 +42,7 @@ class FillTriangles : public FillRectilinear2
|
|||||||
public:
|
public:
|
||||||
virtual Fill* clone() const { return new FillTriangles(*this); };
|
virtual Fill* clone() const { return new FillTriangles(*this); };
|
||||||
virtual ~FillTriangles() {}
|
virtual ~FillTriangles() {}
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
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.
|
||||||
@ -54,7 +54,7 @@ class FillStars : public FillRectilinear2
|
|||||||
public:
|
public:
|
||||||
virtual Fill* clone() const { return new FillStars(*this); };
|
virtual Fill* clone() const { return new FillStars(*this); };
|
||||||
virtual ~FillStars() {}
|
virtual ~FillStars() {}
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
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.
|
||||||
@ -66,14 +66,15 @@ class FillCubic : public FillRectilinear2
|
|||||||
public:
|
public:
|
||||||
virtual Fill* clone() const { return new FillCubic(*this); };
|
virtual Fill* clone() const { return new FillCubic(*this); };
|
||||||
virtual ~FillCubic() {}
|
virtual ~FillCubic() {}
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
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.
|
||||||
virtual float _layer_angle(size_t idx) const { return 0.f; }
|
virtual float _layer_angle(size_t idx) const { return 0.f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class FillRectilinear2Peri : public FillRectilinear2 {
|
class FillRectilinear2Peri : public FillRectilinear2
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
// require bridge flow since it's a pre-bridge over very sparse infill
|
// require bridge flow since it's a pre-bridge over very sparse infill
|
||||||
virtual bool use_bridge_flow() const { return true; }
|
virtual bool use_bridge_flow() const { return true; }
|
||||||
@ -81,8 +82,7 @@ public:
|
|||||||
virtual Fill* clone() const { return new FillRectilinear2Peri(*this); };
|
virtual Fill* clone() const { return new FillRectilinear2Peri(*this); };
|
||||||
virtual ~FillRectilinear2Peri() {}
|
virtual ~FillRectilinear2Peri() {}
|
||||||
//virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
//virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
||||||
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out) override;
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,9 +90,9 @@ public:
|
|||||||
class FillScatteredRectilinear : public FillRectilinear2
|
class FillScatteredRectilinear : public FillRectilinear2
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual Fill* clone() const { return new FillScatteredRectilinear(*this); };
|
virtual Fill* clone() const override{ return new FillScatteredRectilinear(*this); };
|
||||||
virtual ~FillScatteredRectilinear() {}
|
virtual ~FillScatteredRectilinear() {}
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual float _layer_angle(size_t idx) const;
|
virtual float _layer_angle(size_t idx) const;
|
||||||
|
@ -18,31 +18,100 @@ namespace Slic3r {
|
|||||||
return polylines_out;
|
return polylines_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FillSmooth::performSingleFill(const int idx, ExtrusionEntityCollection &eecroot, const Surface &srf_source,
|
||||||
|
const FillParams ¶ms, const double volume){
|
||||||
|
if (srf_source.expolygon.empty()) return;
|
||||||
|
|
||||||
void FillSmooth::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
// Save into layer smoothing path.
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out)
|
ExtrusionEntityCollection *eec = new ExtrusionEntityCollection();
|
||||||
|
eec->no_sort = false;
|
||||||
|
FillParams params_modifided = params;
|
||||||
|
params_modifided.density *= percentWidth[idx];
|
||||||
|
|
||||||
|
if ((params.flow->bridge && idx == 0) || has_overlap[idx]){
|
||||||
|
this->fillExPolygon(idx, *eec, srf_source, params_modifided, volume);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Surface surfaceNoOverlap(srf_source);
|
||||||
|
for (ExPolygon &poly : this->no_overlap_expolygons) {
|
||||||
|
if (poly.empty()) continue;
|
||||||
|
surfaceNoOverlap.expolygon = poly;
|
||||||
|
this->fillExPolygon(idx, *eec, surfaceNoOverlap, params_modifided, volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eec->entities.empty()) delete eec;
|
||||||
|
else eecroot.entities.push_back(eec);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FillSmooth::fillExPolygon(const int idx, ExtrusionEntityCollection &eec, const Surface &srf_to_fill,
|
||||||
|
const FillParams ¶ms, const double volume){
|
||||||
|
|
||||||
|
std::unique_ptr<Fill> f2 = std::unique_ptr<Fill>(Fill::new_from_type(fillPattern[idx]));
|
||||||
|
f2->bounding_box = this->bounding_box;
|
||||||
|
f2->spacing = this->spacing;
|
||||||
|
f2->layer_id = this->layer_id;
|
||||||
|
f2->z = this->z;
|
||||||
|
f2->angle = anglePass[idx] + this->angle;
|
||||||
|
// Maximum length of the perimeter segment linking two infill lines.
|
||||||
|
f2->link_max_length = this->link_max_length;
|
||||||
|
// Used by the concentric infill pattern to clip the loops to create extrusion paths.
|
||||||
|
f2->loop_clipping = this->loop_clipping;
|
||||||
|
Polylines polylines_layer = f2->fill_surface(&srf_to_fill, params);
|
||||||
|
|
||||||
|
if (!polylines_layer.empty()){
|
||||||
|
/*if (fillPattern[idx] == InfillPattern::ipRectilinear && polylines_layer[0].points.size() > 3){
|
||||||
|
polylines_layer[0].points.erase(polylines_layer[0].points.begin());
|
||||||
|
polylines_layer[polylines_layer.size() - 1].points.pop_back();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//compute the path of the nozzle
|
||||||
|
double lengthTot = 0;
|
||||||
|
int nbLines = 0;
|
||||||
|
for (Polyline &pline : polylines_layer){
|
||||||
|
Lines lines = pline.lines();
|
||||||
|
for (Line &line : lines){
|
||||||
|
lengthTot += unscaled(line.length());
|
||||||
|
nbLines++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double extrudedVolume = params.flow->mm3_per_mm() * lengthTot;
|
||||||
|
if (extrudedVolume == 0) extrudedVolume = volume;
|
||||||
|
|
||||||
|
//get the role
|
||||||
|
ExtrusionRole good_role = params.role;
|
||||||
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
|
good_role = params.flow->bridge && idx==0 ? erBridgeInfill : rolePass[idx];
|
||||||
|
}
|
||||||
|
// print thin
|
||||||
|
extrusion_entities_append_paths(
|
||||||
|
eec.entities, std::move(polylines_layer),
|
||||||
|
good_role,
|
||||||
|
params.flow_mult * params.flow->mm3_per_mm() * percentFlow[idx] *
|
||||||
|
(params.fill_exactly ? std::min(2., volume / extrudedVolume) : 1),
|
||||||
|
//min-reduced flow width for a better view (it's only a gui thing)
|
||||||
|
(float)(params.flow->width*(percentFlow[idx] < 0.1 ? 0.1 : percentFlow[idx])), (float)params.flow->height);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FillSmooth::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out)
|
||||||
{
|
{
|
||||||
coordf_t init_spacing = this->spacing;
|
coordf_t init_spacing = this->spacing;
|
||||||
|
|
||||||
//printf("FillSmooth::fill_surface() : you call the right method (fill_surface instead of fill_surface_extrusion).\n");
|
|
||||||
//second pass with half layer width
|
|
||||||
FillParams params1 = params;
|
|
||||||
FillParams params2 = params;
|
|
||||||
FillParams params3 = params;
|
|
||||||
params1.density *= percentWidth[0];
|
|
||||||
params2.density *= percentWidth[1];
|
|
||||||
params3.density *= percentWidth[2];
|
|
||||||
|
|
||||||
// compute the volume to extrude
|
// compute the volume to extrude
|
||||||
double volumeToOccupy = 0;
|
double volumeToOccupy = 0;
|
||||||
for (auto poly = this->no_overlap_expolygons.begin(); poly != this->no_overlap_expolygons.end(); ++poly) {
|
for (auto poly = this->no_overlap_expolygons.begin(); poly != this->no_overlap_expolygons.end(); ++poly) {
|
||||||
// add external "perimeter gap"
|
// add external "perimeter gap"
|
||||||
double poylineVolume = flow.height*unscaled(unscaled(poly->area()));
|
double poylineVolume = params.flow->height*unscaled(unscaled(poly->area()));
|
||||||
double perimeterRoundGap = unscaled(poly->contour.length()) * flow.height * (1 - 0.25*PI) * 0.5;
|
double perimeterRoundGap = unscaled(poly->contour.length()) * params.flow->height * (1 - 0.25*PI) * 0.5;
|
||||||
// add holes "perimeter gaps"
|
// add holes "perimeter gaps"
|
||||||
double holesGaps = 0;
|
double holesGaps = 0;
|
||||||
for (auto hole = poly->holes.begin(); hole != poly->holes.end(); ++hole) {
|
for (auto hole = poly->holes.begin(); hole != poly->holes.end(); ++hole) {
|
||||||
holesGaps += unscaled(hole->length()) * flow.height * (1 - 0.25*PI) * 0.5;
|
holesGaps += unscaled(hole->length()) * params.flow->height * (1 - 0.25*PI) * 0.5;
|
||||||
}
|
}
|
||||||
poylineVolume += perimeterRoundGap + holesGaps;
|
poylineVolume += perimeterRoundGap + holesGaps;
|
||||||
|
|
||||||
@ -61,212 +130,16 @@ namespace Slic3r {
|
|||||||
|
|
||||||
|
|
||||||
// first infill
|
// first infill
|
||||||
std::unique_ptr<Fill> f1 = std::unique_ptr<Fill>(Fill::new_from_type(fillPattern[0]));
|
performSingleFill(0, *eecroot, *surface, params, volumeToOccupy);
|
||||||
f1->bounding_box = this->bounding_box;
|
|
||||||
f1->spacing = init_spacing;
|
|
||||||
f1->layer_id = this->layer_id;
|
|
||||||
f1->z = this->z;
|
|
||||||
f1->angle = anglePass[0];
|
|
||||||
// Maximum length of the perimeter segment linking two infill lines.
|
|
||||||
f1->link_max_length = this->link_max_length;
|
|
||||||
// Used by the concentric infill pattern to clip the loops to create extrusion paths.
|
|
||||||
f1->loop_clipping = this->loop_clipping;
|
|
||||||
Surface surfaceNoOverlap(*surface);
|
|
||||||
if (flow.bridge) {
|
|
||||||
|
|
||||||
Polylines polylines_layer1 = f1->fill_surface(surface, params1);
|
|
||||||
|
|
||||||
if (!polylines_layer1.empty()) {
|
|
||||||
if (fillPattern[2] == InfillPattern::ipRectilinear && polylines_layer1[0].points.size() > 3) {
|
|
||||||
polylines_layer1[0].points.erase(polylines_layer1[0].points.begin());
|
|
||||||
polylines_layer1[polylines_layer1.size() - 1].points.pop_back();
|
|
||||||
}
|
|
||||||
|
|
||||||
//compute the path of the nozzle
|
|
||||||
double lengthTot = 0;
|
|
||||||
int nbLines = 0;
|
|
||||||
for (auto pline = polylines_layer1.begin(); pline != polylines_layer1.end(); ++pline) {
|
|
||||||
Lines lines = pline->lines();
|
|
||||||
for (auto line = lines.begin(); line != lines.end(); ++line) {
|
|
||||||
lengthTot += unscaled(line->length());
|
|
||||||
nbLines++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double extrudedVolume = flow.mm3_per_mm() * lengthTot;
|
|
||||||
if (extrudedVolume == 0) extrudedVolume = 1;
|
|
||||||
|
|
||||||
// Save into layer smoothing path.
|
|
||||||
// print thin
|
|
||||||
|
|
||||||
eec = new ExtrusionEntityCollection();
|
|
||||||
eecroot->entities.push_back(eec);
|
|
||||||
eec->no_sort = false; //can be sorted inside the pass
|
|
||||||
extrusion_entities_append_paths(
|
|
||||||
eec->entities, std::move(polylines_layer1),
|
|
||||||
flow.bridge ? erBridgeInfill : rolePass[0],
|
|
||||||
//reduced flow height for a better view (it's only a gui thing)
|
|
||||||
params.flow_mult * flow.mm3_per_mm() * percentFlow[0] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1),
|
|
||||||
(float)(flow.width*percentFlow[0] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1)), (float)flow.height*0.8);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
for (auto poly = this->no_overlap_expolygons.begin(); poly != this->no_overlap_expolygons.end(); ++poly) {
|
|
||||||
surfaceNoOverlap.expolygon = *poly;
|
|
||||||
Polylines polylines_layer1 = f1->fill_surface(&surfaceNoOverlap, params1);
|
|
||||||
if (!polylines_layer1.empty()) {
|
|
||||||
|
|
||||||
double lengthTot = 0;
|
|
||||||
int nbLines = 0;
|
|
||||||
for (auto pline = polylines_layer1.begin(); pline != polylines_layer1.end(); ++pline) {
|
|
||||||
Lines lines = pline->lines();
|
|
||||||
for (auto line = lines.begin(); line != lines.end(); ++line) {
|
|
||||||
lengthTot += unscaled(line->length());
|
|
||||||
nbLines++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add external "perimeter gap"
|
|
||||||
double poylineVolume = flow.height*unscaled(unscaled(poly->area()));
|
|
||||||
double perimeterRoundGap = unscaled(poly->contour.length()) * flow.height * (1 - 0.25*PI) * 0.5;
|
|
||||||
// add holes "perimeter gaps"
|
|
||||||
double holesGaps = 0;
|
|
||||||
for (auto hole = poly->holes.begin(); hole != poly->holes.end(); ++hole) {
|
|
||||||
holesGaps += unscaled(hole->length()) * flow.height * (1 - 0.25*PI) * 0.5;
|
|
||||||
}
|
|
||||||
poylineVolume += perimeterRoundGap + holesGaps;
|
|
||||||
|
|
||||||
//extruded volume: see http://manual.slic3r.org/advanced/flow-math, and we need to remove a circle at an end (as the flow continue)
|
|
||||||
double extrudedVolume = flow.mm3_per_mm() * lengthTot;
|
|
||||||
|
|
||||||
eec = new ExtrusionEntityCollection();
|
|
||||||
eecroot->entities.push_back(eec);
|
|
||||||
eec->no_sort = false; //can be sorted inside the pass
|
|
||||||
//get the role
|
|
||||||
ExtrusionRole good_role = role;
|
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
|
||||||
good_role = flow.bridge ? erBridgeInfill : rolePass[0];
|
|
||||||
}
|
|
||||||
extrusion_entities_append_paths(
|
|
||||||
eec->entities, std::move(polylines_layer1),
|
|
||||||
good_role,
|
|
||||||
//reduced flow height for a better view (it's only a gui thing)
|
|
||||||
params.flow_mult * flow.mm3_per_mm() * percentFlow[0] * (params.fill_exactly ? poylineVolume / extrudedVolume : 1),
|
|
||||||
(float)(flow.width*percentFlow[0] * (params.fill_exactly ? poylineVolume / extrudedVolume : 1)), (float)flow.height*0.8);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//second infill
|
//second infill
|
||||||
if (nbPass > 1){
|
if (nbPass > 1){
|
||||||
|
performSingleFill(1, *eecroot, *surface, params, volumeToOccupy);
|
||||||
std::unique_ptr<Fill> f2 = std::unique_ptr<Fill>(Fill::new_from_type(fillPattern[1]));
|
|
||||||
f2->bounding_box = this->bounding_box;
|
|
||||||
f2->spacing = init_spacing;
|
|
||||||
f2->layer_id = this->layer_id;
|
|
||||||
f2->z = this->z;
|
|
||||||
f2->angle = anglePass[1];
|
|
||||||
// Maximum length of the perimeter segment linking two infill lines.
|
|
||||||
f2->link_max_length = this->link_max_length;
|
|
||||||
// Used by the concentric infill pattern to clip the loops to create extrusion paths.
|
|
||||||
f2->loop_clipping = this->loop_clipping;
|
|
||||||
Polylines polylines_layer2 = f2->fill_surface(surface, params2);
|
|
||||||
|
|
||||||
if (!polylines_layer2.empty()){
|
|
||||||
if (fillPattern[2] == InfillPattern::ipRectilinear && polylines_layer2[0].points.size() > 3){
|
|
||||||
polylines_layer2[0].points.erase(polylines_layer2[0].points.begin());
|
|
||||||
polylines_layer2[polylines_layer2.size() - 1].points.pop_back();
|
|
||||||
}
|
|
||||||
|
|
||||||
//compute the path of the nozzle
|
|
||||||
double lengthTot = 0;
|
|
||||||
int nbLines = 0;
|
|
||||||
for (auto pline = polylines_layer2.begin(); pline != polylines_layer2.end(); ++pline){
|
|
||||||
Lines lines = pline->lines();
|
|
||||||
for (auto line = lines.begin(); line != lines.end(); ++line){
|
|
||||||
lengthTot += unscaled(line->length());
|
|
||||||
nbLines++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double extrudedVolume = flow.mm3_per_mm() * lengthTot;
|
|
||||||
if (extrudedVolume == 0) extrudedVolume = 1;
|
|
||||||
|
|
||||||
// Save into layer smoothing path.
|
|
||||||
eec = new ExtrusionEntityCollection();
|
|
||||||
eecroot->entities.push_back(eec);
|
|
||||||
eec->no_sort = false;
|
|
||||||
//get the role
|
|
||||||
ExtrusionRole good_role = role;
|
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
|
||||||
good_role = rolePass[1];
|
|
||||||
}
|
|
||||||
// print thin
|
|
||||||
extrusion_entities_append_paths(
|
|
||||||
eec->entities, std::move(polylines_layer2),
|
|
||||||
good_role,
|
|
||||||
params.flow_mult * flow.mm3_per_mm() * percentFlow[1] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1),
|
|
||||||
//min-reduced flow width for a better view (it's only a gui thing)
|
|
||||||
(float)(flow.width*(percentFlow[1] < 0.1 ? 0.1 : percentFlow[1])), (float)flow.height);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// third infill
|
// third infill
|
||||||
if (nbPass > 2){
|
if (nbPass > 2){
|
||||||
std::unique_ptr<Fill> f3 = std::unique_ptr<Fill>(Fill::new_from_type(fillPattern[0]));
|
performSingleFill(2, *eecroot, *surface, params, volumeToOccupy);
|
||||||
f3->bounding_box = this->bounding_box;
|
|
||||||
f3->spacing = init_spacing;
|
|
||||||
f3->layer_id = this->layer_id;
|
|
||||||
f3->z = this->z;
|
|
||||||
f3->angle = anglePass[2];
|
|
||||||
// Maximum length of the perimeter segment linking two infill lines.
|
|
||||||
f3->link_max_length = this->link_max_length;
|
|
||||||
// Used by the concentric infill pattern to clip the loops to create extrusion paths.
|
|
||||||
f3->loop_clipping = this->loop_clipping;
|
|
||||||
Polylines polylines_layer3 = f3->fill_surface(surface, params1);
|
|
||||||
|
|
||||||
if (!polylines_layer3.empty()){
|
|
||||||
|
|
||||||
//remove some points that are not inside the area
|
|
||||||
if (fillPattern[2] == InfillPattern::ipRectilinear && polylines_layer3[0].points.size() > 3){
|
|
||||||
polylines_layer3[0].points.erase(polylines_layer3[0].points.begin());
|
|
||||||
polylines_layer3[polylines_layer3.size() - 1].points.pop_back();
|
|
||||||
}
|
|
||||||
|
|
||||||
//compute the path of the nozzle
|
|
||||||
double lengthTot = 0;
|
|
||||||
int nbLines = 0;
|
|
||||||
for (auto pline = polylines_layer3.begin(); pline != polylines_layer3.end(); ++pline){
|
|
||||||
Lines lines = pline->lines();
|
|
||||||
for (auto line = lines.begin(); line != lines.end(); ++line){
|
|
||||||
lengthTot += unscaled(line->length());
|
|
||||||
nbLines++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
double extrudedVolume = flow.mm3_per_mm() * lengthTot;
|
|
||||||
|
|
||||||
// Save into layer smoothing path. layer 3
|
|
||||||
eec = new ExtrusionEntityCollection();
|
|
||||||
eecroot->entities.push_back(eec);
|
|
||||||
eec->no_sort = false;
|
|
||||||
//get the role
|
|
||||||
ExtrusionRole good_role = role;
|
|
||||||
if (good_role == erNone || good_role == erCustom) {
|
|
||||||
good_role = rolePass[2];
|
|
||||||
}
|
|
||||||
// print thin
|
|
||||||
extrusion_entities_append_paths(
|
|
||||||
eec->entities, std::move(polylines_layer3),
|
|
||||||
good_role, //slow (if last)
|
|
||||||
//reduced flow width for a better view (it's only a gui thing)
|
|
||||||
params.flow_mult * flow.mm3_per_mm() * percentFlow[2] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1),
|
|
||||||
(float)(flow.width*(percentFlow[2] < 0.1 ? 0.1 : percentFlow[2])), (float)flow.height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eecroot->entities.empty())
|
if (!eecroot->entities.empty())
|
||||||
|
@ -12,8 +12,8 @@ class FillSmooth : public Fill
|
|||||||
public:
|
public:
|
||||||
FillSmooth() {
|
FillSmooth() {
|
||||||
nbPass = 2;
|
nbPass = 2;
|
||||||
anglePass[0] = float(M_PI/4);
|
anglePass[0] = 0;
|
||||||
anglePass[1] = -float(M_PI/4);
|
anglePass[1] = float(M_PI/2);
|
||||||
anglePass[2] = 0;
|
anglePass[2] = 0;
|
||||||
fillPattern[0] = InfillPattern::ipRectilinear;
|
fillPattern[0] = InfillPattern::ipRectilinear;
|
||||||
fillPattern[1] = InfillPattern::ipRectilinear;
|
fillPattern[1] = InfillPattern::ipRectilinear;
|
||||||
@ -31,20 +31,28 @@ public:
|
|||||||
percentFlow[0] *= extrusionMult;
|
percentFlow[0] *= extrusionMult;
|
||||||
percentFlow[1] *= extrusionMult;
|
percentFlow[1] *= extrusionMult;
|
||||||
percentFlow[2] *= extrusionMult;
|
percentFlow[2] *= extrusionMult;
|
||||||
|
has_overlap[0] = false;
|
||||||
|
has_overlap[1] = true;
|
||||||
|
has_overlap[2] = false;
|
||||||
}
|
}
|
||||||
virtual Fill* clone() const { return new FillSmooth(*this); }
|
virtual Fill* clone() const{ return new FillSmooth(*this); }
|
||||||
|
|
||||||
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms);
|
virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override;
|
||||||
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, ExtrusionEntitiesPtr &out) override;
|
||||||
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int nbPass=2;
|
int nbPass=2;
|
||||||
double percentWidth[3];
|
double percentWidth[3];
|
||||||
double percentFlow[3];
|
double percentFlow[3];
|
||||||
float anglePass[3];
|
float anglePass[3];
|
||||||
|
bool has_overlap[3];
|
||||||
ExtrusionRole rolePass[3];
|
ExtrusionRole rolePass[3];
|
||||||
InfillPattern fillPattern[3];
|
InfillPattern fillPattern[3];
|
||||||
|
|
||||||
|
void FillSmooth::performSingleFill(const int idx, ExtrusionEntityCollection &eecroot, const Surface &srf_source,
|
||||||
|
const FillParams ¶ms, const double volume);
|
||||||
|
void FillSmooth::fillExPolygon(const int idx, ExtrusionEntityCollection &eec, const Surface &srf_to_fill,
|
||||||
|
const FillParams ¶ms, const double volume);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -52,26 +60,30 @@ class FillSmoothTriple : public FillSmooth
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FillSmoothTriple() {
|
FillSmoothTriple() {
|
||||||
nbPass = 3;
|
nbPass = 1; //3
|
||||||
anglePass[0] = float(M_PI / 4);
|
anglePass[0] = 0;
|
||||||
anglePass[1] = -float(M_PI / 4);
|
anglePass[1] = float(M_PI / 2);
|
||||||
anglePass[2] = float(M_PI / 12); //align with nothing
|
anglePass[2] = float(M_PI / 12); //align with nothing
|
||||||
fillPattern[0] = InfillPattern::ipRectilinear;
|
fillPattern[0] = InfillPattern::ipHilbertCurve; //ipRectilinear
|
||||||
fillPattern[1] = InfillPattern::ipConcentric;
|
fillPattern[1] = InfillPattern::ipConcentric;
|
||||||
fillPattern[2] = InfillPattern::ipRectilinear;
|
fillPattern[2] = InfillPattern::ipRectilinear;
|
||||||
rolePass[0] = erSolidInfill;
|
rolePass[0] = erTopSolidInfill;//erSolidInfill
|
||||||
rolePass[1] = erSolidInfill;
|
rolePass[1] = erSolidInfill;
|
||||||
rolePass[2] = erTopSolidInfill;
|
rolePass[2] = erTopSolidInfill;
|
||||||
percentWidth[0] = 0.8;
|
percentWidth[0] = 1.4; //0.8
|
||||||
percentWidth[1] = 1.5;
|
percentWidth[1] = 1.5;
|
||||||
percentWidth[2] = 2.8;
|
percentWidth[2] = 2.8;
|
||||||
percentFlow[0] = 0.7;
|
percentFlow[0] = 1; //0.7
|
||||||
percentFlow[1] = 0.2;
|
percentFlow[1] = 0.25;
|
||||||
percentFlow[2] = 0.1;
|
percentFlow[2] = 0.15;
|
||||||
double extrusionMult = 1.0;
|
double extrusionMult = 1.0; //slight over-extrusion
|
||||||
percentFlow[0] *= extrusionMult;
|
percentFlow[0] *= extrusionMult;
|
||||||
percentFlow[1] *= extrusionMult;
|
percentFlow[1] *= extrusionMult;
|
||||||
percentFlow[2] *= extrusionMult;
|
percentFlow[2] *= extrusionMult;
|
||||||
|
has_overlap[0] = true;
|
||||||
|
has_overlap[1] = true;
|
||||||
|
has_overlap[2] = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual Fill* clone() const { return new FillSmoothTriple(*this); }
|
virtual Fill* clone() const { return new FillSmoothTriple(*this); }
|
||||||
|
|
||||||
@ -83,24 +95,28 @@ public:
|
|||||||
FillSmoothHilbert() {
|
FillSmoothHilbert() {
|
||||||
nbPass = 2;
|
nbPass = 2;
|
||||||
anglePass[0] = 0;
|
anglePass[0] = 0;
|
||||||
anglePass[1] = -float(M_PI / 4);
|
anglePass[1] = float(M_PI / 4);
|
||||||
anglePass[2] = float(M_PI / 4);
|
anglePass[2] = float(M_PI / 4);
|
||||||
fillPattern[0] = InfillPattern::ipHilbertCurve; //ipHilbertCurve
|
fillPattern[0] = InfillPattern::ipHilbertCurve; //ipHilbertCurve
|
||||||
fillPattern[1] = InfillPattern::ipRectilinear;
|
fillPattern[1] = InfillPattern::ipHilbertCurve;
|
||||||
fillPattern[2] = InfillPattern::ipRectilinear;
|
fillPattern[2] = InfillPattern::ipRectilinear;
|
||||||
rolePass[0] = erSolidInfill;
|
rolePass[0] = erSolidInfill;
|
||||||
rolePass[1] = erSolidInfill;
|
rolePass[1] = erTopSolidInfill;
|
||||||
rolePass[2] = erTopSolidInfill;
|
rolePass[2] = erTopSolidInfill;
|
||||||
percentWidth[0] = 1.0;
|
percentWidth[0] = 1;
|
||||||
percentWidth[1] = 1.0;
|
percentWidth[1] = 1.5;
|
||||||
percentWidth[2] = 1.0;
|
percentWidth[2] = 1.0;
|
||||||
percentFlow[0] = 0.8;
|
percentFlow[0] = 1;
|
||||||
percentFlow[1] = 0.1;
|
percentFlow[1] = 0.0;
|
||||||
percentFlow[2] = 0.1;
|
percentFlow[2] = 0.0;
|
||||||
double extrusionMult = 1.0;
|
double extrusionMult = 1.0;
|
||||||
percentFlow[0] *= extrusionMult;
|
percentFlow[0] *= extrusionMult;
|
||||||
percentFlow[1] *= extrusionMult;
|
percentFlow[1] *= extrusionMult;
|
||||||
percentFlow[2] *= extrusionMult;
|
percentFlow[2] *= extrusionMult;
|
||||||
|
has_overlap[0] = true;
|
||||||
|
has_overlap[1] = false;
|
||||||
|
has_overlap[2] = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
virtual Fill* clone() const { return new FillSmoothHilbert(*this); }
|
virtual Fill* clone() const { return new FillSmoothHilbert(*this); }
|
||||||
|
|
||||||
|
@ -793,8 +793,9 @@ namespace SupportMaterialInternal {
|
|||||||
{
|
{
|
||||||
for (const ExtrusionEntity *ee : perimeters.entities) {
|
for (const ExtrusionEntity *ee : perimeters.entities) {
|
||||||
if (ee->is_collection()) {
|
if (ee->is_collection()) {
|
||||||
|
const ExtrusionEntityCollection * eec = static_cast<const ExtrusionEntityCollection*>(ee);
|
||||||
for (const ExtrusionEntity *ee2 : static_cast<const ExtrusionEntityCollection*>(ee)->entities) {
|
for (const ExtrusionEntity *ee2 : static_cast<const ExtrusionEntityCollection*>(ee)->entities) {
|
||||||
assert(! ee2->is_collection());
|
//assert(! ee2->is_collection()); // there are loops for perimeters and collections for thin walls !!
|
||||||
if (ee2->is_loop())
|
if (ee2->is_loop())
|
||||||
if (has_bridging_perimeters(*static_cast<const ExtrusionLoop*>(ee2)))
|
if (has_bridging_perimeters(*static_cast<const ExtrusionLoop*>(ee2)))
|
||||||
return true;
|
return true;
|
||||||
@ -807,11 +808,12 @@ namespace SupportMaterialInternal {
|
|||||||
static bool has_bridging_fills(const ExtrusionEntityCollection &fills)
|
static bool has_bridging_fills(const ExtrusionEntityCollection &fills)
|
||||||
{
|
{
|
||||||
for (const ExtrusionEntity *ee : fills.entities) {
|
for (const ExtrusionEntity *ee : fills.entities) {
|
||||||
assert(ee->is_collection());
|
if (ee->is_collection()) {
|
||||||
for (const ExtrusionEntity *ee2 : static_cast<const ExtrusionEntityCollection*>(ee)->entities) {
|
if(has_bridging_fills(*static_cast<const ExtrusionEntityCollection*>(ee)))
|
||||||
assert(! ee2->is_collection());
|
return true;
|
||||||
assert(! ee2->is_loop());
|
} else {
|
||||||
if (ee2->role() == erBridgeInfill)
|
assert(! ee->is_loop());
|
||||||
|
if (ee->role() == erBridgeInfill)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2330,9 +2332,11 @@ static inline void fill_expolygons_generate_paths(
|
|||||||
fill_params.density = density;
|
fill_params.density = density;
|
||||||
fill_params.complete = true;
|
fill_params.complete = true;
|
||||||
fill_params.dont_adjust = true;
|
fill_params.dont_adjust = true;
|
||||||
|
fill_params.flow = &flow;
|
||||||
|
fill_params.role = role;
|
||||||
for (const ExPolygon &expoly : expolygons) {
|
for (const ExPolygon &expoly : expolygons) {
|
||||||
Surface surface(stInternal, expoly);
|
Surface surface(stInternal, expoly);
|
||||||
filler->fill_surface_extrusion(&surface, fill_params, flow, role, dst);
|
filler->fill_surface_extrusion(&surface, fill_params, dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2348,9 +2352,11 @@ static inline void fill_expolygons_generate_paths(
|
|||||||
fill_params.density = density;
|
fill_params.density = density;
|
||||||
fill_params.complete = true;
|
fill_params.complete = true;
|
||||||
fill_params.dont_adjust = true;
|
fill_params.dont_adjust = true;
|
||||||
|
fill_params.flow = &flow;
|
||||||
|
fill_params.role = role;
|
||||||
for (ExPolygon &expoly : expolygons) {
|
for (ExPolygon &expoly : expolygons) {
|
||||||
Surface surface(stInternal, std::move(expoly));
|
Surface surface(stInternal, std::move(expoly));
|
||||||
filler->fill_surface_extrusion(&surface, fill_params, flow, role, dst);
|
filler->fill_surface_extrusion(&surface, fill_params, dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user