mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-11 17:59:10 +08:00
Update on infill api.
This commit is contained in:
parent
619370950c
commit
0af53949eb
@ -296,7 +296,7 @@ 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, out);
|
f->fill_surface_extrusion(&surface, params, flow, erNone, out.entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add thin fill regions
|
// add thin fill regions
|
||||||
|
@ -136,7 +136,7 @@ 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, ExtrusionEntityCollection &out) {
|
void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, const Flow &flow, const ExtrusionRole &role, 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())
|
||||||
@ -184,16 +184,22 @@ void Fill::fill_surface_extrusion(const Surface *surface, const FillParams ¶
|
|||||||
/// pass the no_sort attribute to the extrusion path
|
/// pass the no_sort attribute to the extrusion path
|
||||||
eec->no_sort = this->no_sort();
|
eec->no_sort = this->no_sort();
|
||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
out.entities.push_back(eec);
|
out.push_back(eec);
|
||||||
|
//get the role
|
||||||
|
ExtrusionRole good_role = role;
|
||||||
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
|
good_role = (flow.bridge ? erBridgeInfill :
|
||||||
|
(surface->is_solid() ?
|
||||||
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
|
erInternalInfill));
|
||||||
|
}
|
||||||
/// push the path
|
/// push the path
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines),
|
eec->entities, STDMOVE(polylines),
|
||||||
flow.bridge ?
|
good_role,
|
||||||
erBridgeInfill :
|
flow.mm3_per_mm() * params.flow_mult * multFlow,
|
||||||
(surface->is_solid() ?
|
flow.width * params.flow_mult * multFlow,
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
flow.height);
|
||||||
erInternalInfill),
|
|
||||||
flow.mm3_per_mm() * params.flow_mult * multFlow, flow.width * params.flow_mult * multFlow, flow.height);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,9 @@ 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
|
||||||
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, const Flow &flow, ExtrusionEntityCollection &out );
|
// 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,
|
||||||
|
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);
|
||||||
|
@ -1476,7 +1476,10 @@ Polylines FillCubic::fill_surface(const Surface *surface, const FillParams ¶
|
|||||||
|
|
||||||
//Polylines FillRectilinear2Peri::fill_surface(const Surface *surface, const FillParams ¶ms) {
|
//Polylines FillRectilinear2Peri::fill_surface(const Surface *surface, const FillParams ¶ms) {
|
||||||
|
|
||||||
void FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, const Flow &flow, ExtrusionEntityCollection &out) {
|
void
|
||||||
|
FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
||||||
|
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
|
||||||
eecroot->no_sort = true;
|
eecroot->no_sort = true;
|
||||||
@ -1500,15 +1503,22 @@ void FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const
|
|||||||
eec->no_sort = this->no_sort();
|
eec->no_sort = this->no_sort();
|
||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
|
//get the role
|
||||||
|
ExtrusionRole good_role = role;
|
||||||
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
|
good_role = flow.bridge ?
|
||||||
|
erBridgeInfill :
|
||||||
|
(surface->is_solid() ?
|
||||||
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
|
erInternalInfill);
|
||||||
|
}
|
||||||
/// push the path
|
/// push the path
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_1),
|
eec->entities, STDMOVE(polylines_1),
|
||||||
flow.bridge ?
|
good_role,
|
||||||
erBridgeInfill :
|
flow.mm3_per_mm() * params.flow_mult,
|
||||||
(surface->is_solid() ?
|
flow.width * params.flow_mult,
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
flow.height);
|
||||||
erInternalInfill),
|
|
||||||
flow.mm3_per_mm() * params.flow_mult, flow.width * params.flow_mult, flow.height);
|
|
||||||
|
|
||||||
Polylines polylines_2;
|
Polylines polylines_2;
|
||||||
//50% overlap with the new perimeter
|
//50% overlap with the new perimeter
|
||||||
@ -1528,14 +1538,12 @@ void FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const
|
|||||||
/// push the path
|
/// push the path
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_2),
|
eec->entities, STDMOVE(polylines_2),
|
||||||
flow.bridge ?
|
good_role,
|
||||||
erBridgeInfill :
|
flow.mm3_per_mm() * params.flow_mult,
|
||||||
(surface->is_solid() ?
|
flow.width * params.flow_mult,
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
flow.height);
|
||||||
erInternalInfill),
|
|
||||||
flow.mm3_per_mm() * params.flow_mult, flow.width * params.flow_mult, flow.height);
|
|
||||||
|
|
||||||
out.entities.push_back(eecroot);
|
out.push_back(eecroot);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
@ -76,7 +76,8 @@ 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, const Flow &flow, ExtrusionEntityCollection &out);
|
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
||||||
|
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ namespace Slic3r {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FillSmooth::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, const Flow &flow, ExtrusionEntityCollection &out)
|
void FillSmooth::fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
||||||
|
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out)
|
||||||
{
|
{
|
||||||
coordf_t init_spacing = this->spacing;
|
coordf_t init_spacing = this->spacing;
|
||||||
|
|
||||||
@ -142,9 +143,14 @@ namespace Slic3r {
|
|||||||
eec = new ExtrusionEntityCollection();
|
eec = new ExtrusionEntityCollection();
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
eec->no_sort = false; //can be sorted inside the pass
|
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(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_layer1),
|
eec->entities, STDMOVE(polylines_layer1),
|
||||||
flow.bridge ? erBridgeInfill : rolePass[0],
|
good_role,
|
||||||
//reduced flow height for a better view (it's only a gui thing)
|
//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),
|
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);
|
(float)(flow.width*percentFlow[0] * (params.fill_exactly ? poylineVolume / extrudedVolume : 1)), (float)flow.height*0.8);
|
||||||
@ -192,11 +198,15 @@ namespace Slic3r {
|
|||||||
eec = new ExtrusionEntityCollection();
|
eec = new ExtrusionEntityCollection();
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
eec->no_sort = false;
|
eec->no_sort = false;
|
||||||
|
//get the role
|
||||||
|
ExtrusionRole good_role = role;
|
||||||
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
|
good_role = rolePass[1];
|
||||||
|
}
|
||||||
// print thin
|
// print thin
|
||||||
|
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_layer2),
|
eec->entities, STDMOVE(polylines_layer2),
|
||||||
rolePass[1],
|
good_role,
|
||||||
params.flow_mult * flow.mm3_per_mm() * percentFlow[1] * (params.fill_exactly ? volumeToOccupy / extrudedVolume : 1),
|
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)
|
//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);
|
(float)(flow.width*(percentFlow[1] < 0.1 ? 0.1 : percentFlow[1])), (float)flow.height);
|
||||||
@ -244,10 +254,15 @@ namespace Slic3r {
|
|||||||
eec = new ExtrusionEntityCollection();
|
eec = new ExtrusionEntityCollection();
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
eec->no_sort = false;
|
eec->no_sort = false;
|
||||||
|
//get the role
|
||||||
|
ExtrusionRole good_role = role;
|
||||||
|
if (good_role == erNone || good_role == erCustom) {
|
||||||
|
good_role = rolePass[2];
|
||||||
|
}
|
||||||
// print thin
|
// print thin
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_layer3),
|
eec->entities, STDMOVE(polylines_layer3),
|
||||||
rolePass[2], //slow (if last)
|
good_role, //slow (if last)
|
||||||
//reduced flow width for a better view (it's only a gui thing)
|
//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),
|
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);
|
(float)(flow.width*(percentFlow[2] < 0.1 ? 0.1 : percentFlow[2])), (float)flow.height);
|
||||||
@ -255,7 +270,7 @@ namespace Slic3r {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!eecroot->entities.empty())
|
if (!eecroot->entities.empty())
|
||||||
out.entities.push_back(eecroot);
|
out.push_back(eecroot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ public:
|
|||||||
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);
|
||||||
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms, const Flow &flow, ExtrusionEntityCollection &out );
|
virtual void fill_surface_extrusion(const Surface *surface, const FillParams ¶ms,
|
||||||
|
const Flow &flow, const ExtrusionRole &role, ExtrusionEntitiesPtr &out);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int nbPass=2;
|
int nbPass=2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user