mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 19:57:55 -06:00
Fix Rectilinear sparse infill (#5308)
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
parent
81b3e5939d
commit
cc2eb3638d
1 changed files with 17 additions and 14 deletions
|
@ -78,7 +78,7 @@ struct SurfaceFillParams
|
||||||
#define RETURN_COMPARE_NON_EQUAL_TYPED(TYPE, KEY) if (TYPE(this->KEY) < TYPE(rhs.KEY)) return true; if (TYPE(this->KEY) > TYPE(rhs.KEY)) return false;
|
#define RETURN_COMPARE_NON_EQUAL_TYPED(TYPE, KEY) if (TYPE(this->KEY) < TYPE(rhs.KEY)) return true; if (TYPE(this->KEY) > TYPE(rhs.KEY)) return false;
|
||||||
|
|
||||||
// Sort first by decreasing bridging angle, so that the bridges are processed with priority when trimming one layer by the other.
|
// Sort first by decreasing bridging angle, so that the bridges are processed with priority when trimming one layer by the other.
|
||||||
if (this->bridge_angle > rhs.bridge_angle) return true;
|
if (this->bridge_angle > rhs.bridge_angle) return true;
|
||||||
if (this->bridge_angle < rhs.bridge_angle) return false;
|
if (this->bridge_angle < rhs.bridge_angle) return false;
|
||||||
|
|
||||||
RETURN_COMPARE_NON_EQUAL(extruder);
|
RETURN_COMPARE_NON_EQUAL(extruder);
|
||||||
|
@ -186,9 +186,9 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n
|
||||||
Polygons inner_area = intersection(filled_area, opening(filled_area, 2 * scaled_spacing, 3 * scaled_spacing));
|
Polygons inner_area = intersection(filled_area, opening(filled_area, 2 * scaled_spacing, 3 * scaled_spacing));
|
||||||
|
|
||||||
inner_area = shrink(inner_area, scaled_spacing * 0.5 - scaled<double>(fill.params.overlap));
|
inner_area = shrink(inner_area, scaled_spacing * 0.5 - scaled<double>(fill.params.overlap));
|
||||||
|
|
||||||
AABBTreeLines::LinesDistancer<Line> area_walls{to_lines(inner_area)};
|
AABBTreeLines::LinesDistancer<Line> area_walls{to_lines(inner_area)};
|
||||||
|
|
||||||
const size_t n_vlines = (bb.max.x() - bb.min.x() + scaled_spacing - 1) / scaled_spacing;
|
const size_t n_vlines = (bb.max.x() - bb.min.x() + scaled_spacing - 1) / scaled_spacing;
|
||||||
std::vector<Line> vertical_lines(n_vlines);
|
std::vector<Line> vertical_lines(n_vlines);
|
||||||
coord_t y_min = bb.min.y();
|
coord_t y_min = bb.min.y();
|
||||||
|
@ -203,7 +203,7 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n
|
||||||
vertical_lines.back().a = Point{coord_t(bb.min.x() + n_vlines * double(scaled_spacing) + scaled_spacing * 0.5), y_min};
|
vertical_lines.back().a = Point{coord_t(bb.min.x() + n_vlines * double(scaled_spacing) + scaled_spacing * 0.5), y_min};
|
||||||
vertical_lines.back().b = Point{vertical_lines.back().a.x(), y_max};
|
vertical_lines.back().b = Point{vertical_lines.back().a.x(), y_max};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::vector<Line>> polygon_sections(n_vlines);
|
std::vector<std::vector<Line>> polygon_sections(n_vlines);
|
||||||
|
|
||||||
for (size_t i = 0; i < n_vlines; i++) {
|
for (size_t i = 0; i < n_vlines; i++) {
|
||||||
|
@ -228,7 +228,7 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n
|
||||||
bool neighbours_explored = false;
|
bool neighbours_explored = false;
|
||||||
std::vector<std::pair<int, int>> neighbours{};
|
std::vector<std::pair<int, int>> neighbours{};
|
||||||
};
|
};
|
||||||
|
|
||||||
coord_t length_filter = scale_(4);
|
coord_t length_filter = scale_(4);
|
||||||
size_t skips_allowed = 2;
|
size_t skips_allowed = 2;
|
||||||
size_t min_removal_conut = 5;
|
size_t min_removal_conut = 5;
|
||||||
|
@ -301,7 +301,7 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n
|
||||||
std::sort(polygon_sections[section_idx].begin(), polygon_sections[section_idx].end(),
|
std::sort(polygon_sections[section_idx].begin(), polygon_sections[section_idx].end(),
|
||||||
[](const Line &a, const Line &b) { return a.a.y() < b.b.y(); });
|
[](const Line &a, const Line &b) { return a.a.y() < b.b.y(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygons reconstructed_area{};
|
Polygons reconstructed_area{};
|
||||||
// reconstruct polygon from polygon sections
|
// reconstruct polygon from polygon sections
|
||||||
{
|
{
|
||||||
|
@ -496,10 +496,13 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.bridge_angle = float(surface.bridge_angle);
|
params.bridge_angle = float(surface.bridge_angle);
|
||||||
params.angle = float(Geometry::deg2rad(params.extrusion_role == erInternalInfill ?
|
if (params.extrusion_role == erInternalInfill) {
|
||||||
region_config.infill_direction :
|
params.angle = float(Geometry::deg2rad(region_config.infill_direction.value));
|
||||||
region_config.solid_infill_direction.value));
|
params.rotate_angle = (params.pattern == ipRectilinear);
|
||||||
params.rotate_angle = (params.extrusion_role != erInternalInfill) && region_config.rotate_solid_infill_direction;
|
} else {
|
||||||
|
params.angle = float(Geometry::deg2rad(region_config.solid_infill_direction.value));
|
||||||
|
params.rotate_angle = region_config.rotate_solid_infill_direction;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate the actual flow we'll be using for this infill.
|
// Calculate the actual flow we'll be using for this infill.
|
||||||
params.bridge = is_bridge || Fill::use_bridge_flow(params.pattern);
|
params.bridge = is_bridge || Fill::use_bridge_flow(params.pattern);
|
||||||
|
@ -660,7 +663,7 @@ std::vector<SurfaceFill> group_fills(const Layer &layer)
|
||||||
params.rotate_angle = layerm.region().config().rotate_solid_infill_direction;
|
params.rotate_angle = layerm.region().config().rotate_solid_infill_direction;
|
||||||
// calculate the actual flow we'll be using for this infill
|
// calculate the actual flow we'll be using for this infill
|
||||||
params.flow = layerm.flow(frSolidInfill);
|
params.flow = layerm.flow(frSolidInfill);
|
||||||
params.spacing = params.flow.spacing();
|
params.spacing = params.flow.spacing();
|
||||||
surface_fills.emplace_back(params);
|
surface_fills.emplace_back(params);
|
||||||
surface_fills.back().surface.surface_type = stInternalSolid;
|
surface_fills.back().surface.surface_type = stInternalSolid;
|
||||||
surface_fills.back().surface.thickness = layer.height;
|
surface_fills.back().surface.thickness = layer.height;
|
||||||
|
@ -728,7 +731,7 @@ void export_group_fills_to_svg(const char *path, const std::vector<SurfaceFill>
|
||||||
for (const auto &expoly : fill.expolygons)
|
for (const auto &expoly : fill.expolygons)
|
||||||
svg.draw(expoly, surface_type_to_color_name(fill.surface.surface_type), transparency);
|
svg.draw(expoly, surface_type_to_color_name(fill.surface.surface_type), transparency);
|
||||||
export_surface_type_legend_to_svg(svg, legend_pos);
|
export_surface_type_legend_to_svg(svg, legend_pos);
|
||||||
svg.Close();
|
svg.Close();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -994,7 +997,7 @@ void Layer::make_ironing()
|
||||||
// ironing flowrate (5% percent)
|
// ironing flowrate (5% percent)
|
||||||
// ironing speed (10 mm/sec)
|
// ironing speed (10 mm/sec)
|
||||||
|
|
||||||
// Kisslicer:
|
// Kisslicer:
|
||||||
// iron off, Sweep, Group
|
// iron off, Sweep, Group
|
||||||
// ironing speed: 15 mm/sec
|
// ironing speed: 15 mm/sec
|
||||||
|
|
||||||
|
@ -1014,7 +1017,7 @@ void Layer::make_ironing()
|
||||||
const PrintRegionConfig &config = layerm->region().config();
|
const PrintRegionConfig &config = layerm->region().config();
|
||||||
if (config.ironing_type != IroningType::NoIroning &&
|
if (config.ironing_type != IroningType::NoIroning &&
|
||||||
(config.ironing_type == IroningType::AllSolid ||
|
(config.ironing_type == IroningType::AllSolid ||
|
||||||
(config.top_shell_layers > 0 &&
|
(config.top_shell_layers > 0 &&
|
||||||
(config.ironing_type == IroningType::TopSurfaces ||
|
(config.ironing_type == IroningType::TopSurfaces ||
|
||||||
(config.ironing_type == IroningType::TopmostOnly && layerm->layer()->upper_layer == nullptr))))) {
|
(config.ironing_type == IroningType::TopmostOnly && layerm->layer()->upper_layer == nullptr))))) {
|
||||||
if (config.wall_filament == config.solid_infill_filament || config.wall_loops == 0) {
|
if (config.wall_filament == config.solid_infill_filament || config.wall_loops == 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue