mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 04:16:00 +08:00
better rectilinear infill:
* allow to connect at one side even if not connected on the other one * extrude a small start of connection on the "empty" side if it's too far away (but not too too far) : poor's man gap fill
This commit is contained in:
parent
ee52026342
commit
bf487225cc
@ -270,13 +270,8 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
|
||||
double link_max_length = 0.;
|
||||
if (! is_bridge) {
|
||||
#if 0
|
||||
link_max_length = layerm.region()->config().get_abs_value(surface.is_external() ? "external_fill_link_max_length" : "fill_link_max_length", flow.spacing());
|
||||
// printf("flow spacing: %f, is_external: %d, link_max_length: %lf\n", flow.spacing(), int(surface.is_external()), link_max_length);
|
||||
#else
|
||||
if (density > 80.) // 80%
|
||||
link_max_length = 3. * f->spacing;
|
||||
#endif
|
||||
link_max_length = 3 * f->spacing; // slic3r default : 3
|
||||
}
|
||||
|
||||
f->layer_id = layerm.layer()->id();
|
||||
|
@ -1253,15 +1253,34 @@ bool FillRectilinear2::fill_surface_by_lines(const Surface *surface, const FillP
|
||||
(distNext < distPrev) :
|
||||
intrsctn_type_next == INTERSECTION_TYPE_OTHER_VLINE_OK;
|
||||
assert(intrsctn->is_inner());
|
||||
bool skip = params.dont_connect || (link_max_length > 0 && (take_next ? distNext : distPrev) > link_max_length);
|
||||
bool skip = params.dont_connect || (link_max_length > 0 && (take_next ? distNext : distPrev) > link_max_length * 3);
|
||||
if (skip) {
|
||||
// Just skip the connecting contour and start a new path.
|
||||
goto dont_connect;
|
||||
polyline_current->points.push_back(Point(seg.pos, intrsctn->pos()));
|
||||
}
|
||||
skip = params.dont_connect || (link_max_length > 0 && (take_next ? distNext : distPrev) > link_max_length);
|
||||
if (skip) {
|
||||
//"skip" the connection but continue to do as it was printed
|
||||
//also, add a bit of extrusion at the tip, to not under-extrude
|
||||
//TODO: supermerill: don't output polyline but Extrusion entiyt, to be able to extrude a small line here (gap-fill style) instead of big bits.
|
||||
Point last_point = Point(seg.pos, intrsctn->pos());
|
||||
const SegmentedIntersectionLine &il2 = segs[take_next ? (i_vline + 1) : (i_vline - 1)];
|
||||
Point next_point = Point(il2.pos, il2.intersections[take_next ? iNext : iPrev].pos());
|
||||
//compute angle to see where it's possible to extrude a bit
|
||||
float coeff_before = 0.5f;
|
||||
if (!polyline_current->points.empty()) coeff_before = 1 - std::abs(((last_point.ccw_angle(polyline_current->points.back(), next_point)) / PI) - 1);
|
||||
if (coeff_before < 0.2) coeff_before = 0.0;
|
||||
if (coeff_before > 0.8) coeff_before = 1.0;
|
||||
//now add the points at the end of the current polyline
|
||||
polyline_current->points.push_back(last_point);
|
||||
if (coeff_before > 0.0)
|
||||
polyline_current->points.push_back(last_point.interpolate(coeff_before * scale_(this->spacing) / ( (take_next ? distNext : distPrev)), next_point));
|
||||
//now create & add the points at the start of the new polyline
|
||||
polylines_out.push_back(Polyline());
|
||||
polyline_current = &polylines_out.back();
|
||||
const SegmentedIntersectionLine &il2 = segs[take_next ? (i_vline + 1) : (i_vline - 1)];
|
||||
polyline_current->points.push_back(Point(il2.pos, il2.intersections[take_next ? iNext : iPrev].pos()));
|
||||
if (coeff_before < 1.0)
|
||||
polyline_current->points.push_back(next_point.interpolate((1 - coeff_before) * scale_(this->spacing) / ( (take_next ? distNext : distPrev)), last_point));
|
||||
polyline_current->points.push_back(next_point);
|
||||
} else {
|
||||
polyline_current->points.push_back(Point(seg.pos, intrsctn->pos()));
|
||||
emit_perimeter_prev_next_segment(poly_with_offset, segs, i_vline, intrsctn->iContour, i_intersection, take_next ? iNext : iPrev, *polyline_current, take_next);
|
||||
|
@ -534,10 +534,8 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
|
||||
|| opt_key == "bottom_fill_pattern"
|
||||
|| opt_key == "solid_fill_pattern"
|
||||
|| opt_key == "enforce_full_fill_volume"
|
||||
|| opt_key == "external_fill_link_max_length"
|
||||
|| opt_key == "fill_angle"
|
||||
|| opt_key == "fill_pattern"
|
||||
|| opt_key == "fill_link_max_length"
|
||||
|| opt_key == "top_infill_extrusion_width"
|
||||
|| opt_key == "first_layer_extrusion_width") {
|
||||
steps.emplace_back(posInfill);
|
||||
|
Loading…
x
Reference in New Issue
Block a user