Fix Line Infill with no anchor (#9768)

* Fix Line Fill with no anchor

Co-Authored-By: Rodrigo <162915171+RF47@users.noreply.github.com>

* Disable anchor option for Line Infill

Co-Authored-By: Rodrigo <162915171+RF47@users.noreply.github.com>
Co-Authored-By: Henk <40023052+elektrohenk@users.noreply.github.com>

---------

Co-authored-by: Rodrigo <162915171+RF47@users.noreply.github.com>
Co-authored-by: Henk <40023052+elektrohenk@users.noreply.github.com>
This commit is contained in:
Ian Bassi 2025-06-01 02:34:44 -03:00 committed by GitHub
parent 17586cf0a1
commit 6423d521cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View file

@ -23,7 +23,7 @@ void FillLine::_fill_surface_single(
this->_diagonal_distance = this->_line_spacing * 2;
this->_line_oscillation = this->_line_spacing - this->_min_spacing; // only for Line infill
BoundingBox bounding_box = expolygon.contour.bounding_box();
// define flow spacing according to requested density
if (params.density > 0.9999f && !params.dont_adjust) {
this->_line_spacing = this->_adjust_solid_spacing(bounding_box.size()(0), this->_line_spacing);
@ -32,8 +32,8 @@ void FillLine::_fill_surface_single(
// extend bounding box so that our pattern will be aligned with other layers
// Transform the reference point to the rotated coordinate system.
bounding_box.merge(align_to_grid(
bounding_box.min,
Point(this->_line_spacing, this->_line_spacing),
bounding_box.min,
Point(this->_line_spacing, this->_line_spacing),
direction.second.rotated(- direction.first)));
}
@ -46,7 +46,7 @@ void FillLine::_fill_surface_single(
// clip paths against a slightly larger expolygon, so that the first and last paths
// are kept even if the expolygon has vertical sides
// the minimum offset for preventing edge lines from being clipped is SCALED_EPSILON;
// however we use a larger offset to support expolygons with slightly skewed sides and
// however we use a larger offset to support expolygons with slightly skewed sides and
// not perfectly straight
//FIXME Vojtech: Update the intersecton function to work directly with lines.
Polylines polylines_src;
@ -76,7 +76,7 @@ void FillLine::_fill_surface_single(
size_t n_polylines_out_old = polylines_out.size();
// connect lines
if (! params.dont_connect() && ! polylines.empty()) { // prevent calling leftmost_point() on empty collections
if (! polylines.empty()) { // prevent calling leftmost_point() on empty collections
// offset the expolygon by max(min_spacing/2, extra)
ExPolygon expolygon_off;
{
@ -96,9 +96,9 @@ void FillLine::_fill_surface_single(
const Point &last_point = pts_end.back();
// Distance in X, Y.
const Vector distance = last_point - first_point;
// TODO: we should also check that both points are on a fill_boundary to avoid
// TODO: we should also check that both points are on a fill_boundary to avoid
// connecting paths on the boundaries of internal regions
if (this->_can_connect(std::abs(distance(0)), std::abs(distance(1))) &&
if (this->_can_connect(std::abs(distance(0)), std::abs(distance(1))) &&
expolygon_off.contains(Line(last_point, first_point))) {
// Append the polyline.
pts_end.insert(pts_end.end(), polyline.points.begin(), polyline.points.end());

View file

@ -521,8 +521,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
bool have_combined_infill = config->opt_bool("infill_combination") && have_infill;
toggle_line("infill_combination_max_layer_height", have_combined_infill);
bool infill_anchor = config->opt_enum<InfillPattern>("sparse_infill_pattern") != ipLine;
toggle_field("infill_anchor_max",infill_anchor);
// Only allow configuration of open anchors if the anchoring is enabled.
bool has_infill_anchors = have_infill && config->option<ConfigOptionFloatOrPercent>("infill_anchor_max")->value > 0;
bool has_infill_anchors = have_infill && config->option<ConfigOptionFloatOrPercent>("infill_anchor_max")->value > 0 && infill_anchor;
toggle_field("infill_anchor", has_infill_anchors);
bool has_spiral_vase = config->opt_bool("spiral_mode");