mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
ENH: improve archor of internal bridge
Add loop inside sparse infill of lower layer to provide archor for internal bridge. This option controls how many lower layers generate loop path. Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: Ifdb6db9090115732aa2cacf5d155b587a10e18fc (cherry picked from commit 4fdb87ecd5c2e680f6bad2d018ba39cd05f787ce)
This commit is contained in:
parent
08494b5f6f
commit
588f18ac58
18 changed files with 141 additions and 15 deletions
|
@ -46,6 +46,8 @@ struct SurfaceFillParams
|
|||
// 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;
|
||||
//BBS
|
||||
bool with_loop = false;
|
||||
|
||||
// width, height of extrusion, nozzle diameter, is bridge
|
||||
// For the output, for fill generator.
|
||||
|
@ -77,6 +79,7 @@ struct SurfaceFillParams
|
|||
// RETURN_COMPARE_NON_EQUAL_TYPED(unsigned, dont_adjust);
|
||||
RETURN_COMPARE_NON_EQUAL(anchor_length);
|
||||
RETURN_COMPARE_NON_EQUAL(anchor_length_max);
|
||||
RETURN_COMPARE_NON_EQUAL(with_loop);
|
||||
RETURN_COMPARE_NON_EQUAL(flow.width());
|
||||
RETURN_COMPARE_NON_EQUAL(flow.height());
|
||||
RETURN_COMPARE_NON_EQUAL(flow.nozzle_diameter());
|
||||
|
@ -97,6 +100,7 @@ struct SurfaceFillParams
|
|||
// this->dont_adjust == rhs.dont_adjust &&
|
||||
this->anchor_length == rhs.anchor_length &&
|
||||
this->anchor_length_max == rhs.anchor_length_max &&
|
||||
this->with_loop == rhs.with_loop &&
|
||||
this->flow == rhs.flow &&
|
||||
this->extrusion_role == rhs.extrusion_role;
|
||||
}
|
||||
|
@ -147,6 +151,8 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
|
|||
params.extruder = layerm.region().extruder(extrusion_role);
|
||||
params.pattern = region_config.sparse_infill_pattern.value;
|
||||
params.density = float(region_config.sparse_infill_density);
|
||||
//BBS
|
||||
params.with_loop = surface.surface_type == stInternalWithLoop;
|
||||
|
||||
if (surface.is_solid()) {
|
||||
params.density = 100.f;
|
||||
|
@ -465,6 +471,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
|
|||
params.extrusion_role = surface_fill.params.extrusion_role;
|
||||
params.using_internal_flow = using_internal_flow;
|
||||
params.no_extrusion_overlap = surface_fill.params.overlap;
|
||||
params.with_loop = surface_fill.params.with_loop;
|
||||
|
||||
LayerRegion* layerm = this->m_regions[surface_fill.region_id];
|
||||
for (ExPolygon& expoly : surface_fill.expolygons) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace Slic3r {
|
||||
|
||||
//BBS: 0% of sparse_infill_line_width, no anchor at the start of sparse infill
|
||||
float Fill::infill_anchor = 0;
|
||||
float Fill::infill_anchor = 400;
|
||||
//BBS: 20mm
|
||||
float Fill::infill_anchor_max = 20;
|
||||
|
||||
|
@ -122,13 +122,57 @@ void Fill::fill_surface_extrusion(const Surface* surface, const FillParams& para
|
|||
{
|
||||
Polylines polylines;
|
||||
ThickPolylines thick_polylines;
|
||||
try {
|
||||
if (params.use_arachne)
|
||||
thick_polylines = this->fill_surface_arachne(surface, params);
|
||||
else
|
||||
polylines = this->fill_surface(surface, params);
|
||||
if (!params.with_loop) {
|
||||
try {
|
||||
if (params.use_arachne)
|
||||
thick_polylines = this->fill_surface_arachne(surface, params);
|
||||
else
|
||||
polylines = this->fill_surface(surface, params);
|
||||
}
|
||||
catch (InfillFailedException&) {}
|
||||
}
|
||||
//BBS: add handling for infill pattern with loop
|
||||
else {
|
||||
Slic3r::ExPolygons expp = offset_ex(surface->expolygon, float(scale_(this->overlap - 0.5 * this->spacing)));
|
||||
Polylines loop_polylines = to_polylines(expp);
|
||||
{
|
||||
//BBS: clip the loop
|
||||
size_t j = 0;
|
||||
for (size_t i = 0; i < loop_polylines.size(); ++i) {
|
||||
loop_polylines[i].clip_end(this->loop_clipping);
|
||||
if (loop_polylines[i].is_valid()) {
|
||||
if (j < i)
|
||||
loop_polylines[j] = std::move(loop_polylines[i]);
|
||||
++j;
|
||||
}
|
||||
}
|
||||
if (j < loop_polylines.size())
|
||||
loop_polylines.erase(loop_polylines.begin() + int(j), loop_polylines.end());
|
||||
}
|
||||
|
||||
if (!loop_polylines.empty()) {
|
||||
if (params.use_arachne)
|
||||
append(thick_polylines, to_thick_polylines(std::move(loop_polylines), scaled<coord_t>(this->spacing)));
|
||||
else
|
||||
append(polylines, std::move(loop_polylines));
|
||||
expp = offset_ex(expp, float(scale_(0 - 0.5 * this->spacing)));
|
||||
} else {
|
||||
//BBS: the area is too narrow to place a loop, return to original expolygon
|
||||
expp = { surface->expolygon };
|
||||
}
|
||||
|
||||
Surface temp_surface = *surface;
|
||||
for (ExPolygon& ex : expp) {
|
||||
temp_surface.expolygon = ex;
|
||||
try {
|
||||
if (params.use_arachne)
|
||||
append(thick_polylines, std::move(this->fill_surface_arachne(&temp_surface, params)));
|
||||
else
|
||||
append(polylines, std::move(this->fill_surface(&temp_surface, params)));
|
||||
}
|
||||
catch (InfillFailedException&) {}
|
||||
}
|
||||
}
|
||||
catch (InfillFailedException&) {}
|
||||
|
||||
if (!polylines.empty() || !thick_polylines.empty()) {
|
||||
// calculate actual flow from spacing (which might have been adjusted by the infill
|
||||
|
|
|
@ -67,6 +67,8 @@ struct FillParams
|
|||
bool use_arachne{ false };
|
||||
// Layer height for Concentric infill with Arachne.
|
||||
coordf_t layer_height { 0.f };
|
||||
//BBS
|
||||
bool with_loop { false };
|
||||
|
||||
// BBS
|
||||
Flow flow;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue