Fix infill anchor missing for FillPlanePath (#9462)

Fix infill anchor missing for archimedian chords, hilbert curve and octagram spiral infill pattern
This commit is contained in:
Henk 2025-04-24 05:03:28 +02:00 committed by GitHub
parent 09f2ee467b
commit 672c115c61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,42 +119,44 @@ void FillPlanePath::_fill_surface_single(
if (polyline.size() >= 2) { if (polyline.size() >= 2) {
Polylines polylines = intersection_pl(polyline, expolygon); Polylines polylines = intersection_pl(polyline, expolygon);
Polylines chained; if (!polylines.empty()) {
if (params.dont_connect() || params.density > 0.5 || polylines.size() <= 1) { Polylines chained;
// ORCA: special flag for flow rate calibration if (params.dont_connect() || params.density > 0.5) {
auto is_flow_calib = params.extrusion_role == erTopSolidInfill && // ORCA: special flag for flow rate calibration
this->print_object_config->has("calib_flowrate_topinfill_special_order") && auto is_flow_calib = params.extrusion_role == erTopSolidInfill &&
this->print_object_config->option("calib_flowrate_topinfill_special_order")->getBool() && this->print_object_config->has("calib_flowrate_topinfill_special_order") &&
dynamic_cast<FillArchimedeanChords*>(this); this->print_object_config->option("calib_flowrate_topinfill_special_order")->getBool() &&
if (is_flow_calib) { dynamic_cast<FillArchimedeanChords*>(this);
// We want the spiral part to be printed inside-out if (is_flow_calib) {
// Find the center spiral line first, by looking for the longest one // We want the spiral part to be printed inside-out
auto it = std::max_element(polylines.begin(), polylines.end(), [](const Polyline& a, const Polyline& b) { return a.length() < b.length(); }); // Find the center spiral line first, by looking for the longest one
Polyline center_spiral = std::move(*it); auto it = std::max_element(polylines.begin(), polylines.end(),
[](const Polyline& a, const Polyline& b) { return a.length() < b.length(); });
Polyline center_spiral = std::move(*it);
// Ensure the spiral is printed from inside to out // Ensure the spiral is printed from inside to out
if (center_spiral.first_point().squaredNorm() > center_spiral.last_point().squaredNorm()) { if (center_spiral.first_point().squaredNorm() > center_spiral.last_point().squaredNorm()) {
center_spiral.reverse(); center_spiral.reverse();
}
// Chain the other polylines
polylines.erase(it);
chained = chain_polylines(std::move(polylines));
// Then add the center spiral back
chained.push_back(std::move(center_spiral));
} else {
chained = chain_polylines(std::move(polylines));
} }
} else
// Chain the other polylines connect_infill(std::move(polylines), expolygon, chained, this->spacing, params);
polylines.erase(it); // paths must be repositioned and rotated back
chained = chain_polylines(std::move(polylines)); for (Polyline& pl : chained) {
pl.translate(shift.x(), shift.y());
// Then add the center spiral back pl.rotate(direction.first);
chained.push_back(std::move(center_spiral));
} else {
chained = chain_polylines(std::move(polylines));
} }
append(polylines_out, std::move(chained));
} }
else
connect_infill(std::move(polylines), expolygon, chained, this->spacing, params);
// paths must be repositioned and rotated back
for (Polyline &pl : chained) {
pl.translate(shift.x(), shift.y());
pl.rotate(direction.first);
}
append(polylines_out, std::move(chained));
} }
} }