mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-16 05:25:57 +08:00
bugfix: dense_infill too small region make export gcode crash
This commit is contained in:
parent
7d1b6bd680
commit
e482c84e98
@ -1481,10 +1481,10 @@ void FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const
|
|||||||
//you don't want to sort the extrusions: big infill first, small second
|
//you don't want to sort the extrusions: big infill first, small second
|
||||||
eecroot->no_sort = true;
|
eecroot->no_sort = true;
|
||||||
|
|
||||||
|
// === extrude perimeter ===
|
||||||
Polylines polylines_1;
|
Polylines polylines_1;
|
||||||
//generate perimeter:
|
//generate perimeter:
|
||||||
//TODO: better optimize start/end point?
|
ExPolygons path_perimeter = offset2_ex(surface->expolygon, scale_(-this->spacing), scale_(this->spacing / 2));
|
||||||
ExPolygons path_perimeter = offset_ex(surface->expolygon, scale_(-this->spacing/2));
|
|
||||||
for (ExPolygon &expolygon : path_perimeter) {
|
for (ExPolygon &expolygon : path_perimeter) {
|
||||||
expolygon.contour.make_counter_clockwise();
|
expolygon.contour.make_counter_clockwise();
|
||||||
polylines_1.push_back(expolygon.contour.split_at_index(0));
|
polylines_1.push_back(expolygon.contour.split_at_index(0));
|
||||||
@ -1494,48 +1494,61 @@ void FillRectilinear2Peri::fill_surface_extrusion(const Surface *surface, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!polylines_1.empty()) {
|
||||||
// Save into layer.
|
// Save into layer.
|
||||||
auto *eec = new ExtrusionEntityCollection();
|
ExtrusionEntityCollection *eec = new ExtrusionEntityCollection();
|
||||||
/// pass the no_sort attribute to the extrusion path
|
/// pass the no_sort attribute to the extrusion path
|
||||||
eec->no_sort = this->no_sort();
|
eec->no_sort = this->no_sort();
|
||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
/// push the path
|
/// push the path
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_1),
|
eec->entities, (polylines_1),
|
||||||
flow.bridge ?
|
flow.bridge ?
|
||||||
erBridgeInfill :
|
erBridgeInfill :
|
||||||
(surface->is_solid() ?
|
(surface->is_solid() ?
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
erInternalInfill),
|
erInternalInfill),
|
||||||
flow.mm3_per_mm() * params.flow_mult, flow.width * params.flow_mult, flow.height);
|
flow.mm3_per_mm() * params.flow_mult, flow.width * params.flow_mult, flow.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// === extrude dense infill ===
|
||||||
Polylines polylines_2;
|
Polylines polylines_2;
|
||||||
|
bool canFill = true;
|
||||||
//50% overlap with the new perimeter
|
//50% overlap with the new perimeter
|
||||||
ExPolygons path_inner = offset2_ex(surface->expolygon, scale_(-this->spacing * 1.5), scale_(this->spacing));
|
ExPolygons path_inner = offset2_ex(surface->expolygon, scale_(-this->spacing * 1.5), scale_(this->spacing));
|
||||||
for (ExPolygon &expolygon : path_inner) {
|
for (ExPolygon &expolygon : path_inner) {
|
||||||
Surface surfInner(*surface, expolygon);
|
Surface surfInner(*surface, expolygon);
|
||||||
if (!fill_surface_by_lines(&surfInner, params, 0.f, 0.f, polylines_2)) {
|
if (!fill_surface_by_lines(&surfInner, params, 0.f, 0.f, polylines_2)) {
|
||||||
printf("FillRectilinear2::fill_surface() failed to fill a region.\n");
|
printf("FillRectilinear2::fill_surface() failed to fill a region.\n");
|
||||||
|
canFill = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (canFill && !polylines_2.empty()) {
|
||||||
// Save into layer.
|
// Save into layer.
|
||||||
eec = new ExtrusionEntityCollection();
|
ExtrusionEntityCollection *eec = new ExtrusionEntityCollection();
|
||||||
/// pass the no_sort attribute to the extrusion path
|
/// pass the no_sort attribute to the extrusion path
|
||||||
eec->no_sort = this->no_sort();
|
eec->no_sort = this->no_sort();
|
||||||
/// add it into the collection
|
/// add it into the collection
|
||||||
eecroot->entities.push_back(eec);
|
eecroot->entities.push_back(eec);
|
||||||
/// push the path
|
/// push the path
|
||||||
extrusion_entities_append_paths(
|
extrusion_entities_append_paths(
|
||||||
eec->entities, STDMOVE(polylines_2),
|
eec->entities, (polylines_2),
|
||||||
flow.bridge ?
|
flow.bridge ?
|
||||||
erBridgeInfill :
|
erBridgeInfill :
|
||||||
(surface->is_solid() ?
|
(surface->is_solid() ?
|
||||||
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
((surface->is_top()) ? erTopSolidInfill : erSolidInfill) :
|
||||||
erInternalInfill),
|
erInternalInfill),
|
||||||
flow.mm3_per_mm() * params.flow_mult, flow.width * params.flow_mult, flow.height);
|
flow.mm3_per_mm() * params.flow_mult, flow.width * params.flow_mult, flow.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// === end ===
|
||||||
|
if (!eecroot->empty()) {
|
||||||
out.entities.push_back(eecroot);
|
out.entities.push_back(eecroot);
|
||||||
|
} else {
|
||||||
|
delete eecroot;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user