mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-10 00:07:52 -06:00
FIX: sequential_print_clearance_valid may crash due to clipper's bug
offset may give empty results. Jira: STUDIO-2452 Change-Id: I4da9689dc3e22afcb2340ce0f9956237e4aab434 (cherry picked from commit 3f33979a79c720fcaddb5b850ec278b3deaf2417)
This commit is contained in:
parent
c098e01b22
commit
f227a8f8da
1 changed files with 8 additions and 5 deletions
|
@ -460,14 +460,17 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
|
||||||
// Now we check that no instance of convex_hull intersects any of the previously checked object instances.
|
// Now we check that no instance of convex_hull intersects any of the previously checked object instances.
|
||||||
for (const PrintInstance &instance : print_object->instances()) {
|
for (const PrintInstance &instance : print_object->instances()) {
|
||||||
Polygon convex_hull_no_offset = convex_hull0, convex_hull;
|
Polygon convex_hull_no_offset = convex_hull0, convex_hull;
|
||||||
convex_hull = offset(convex_hull_no_offset,
|
auto tmp = offset(convex_hull_no_offset,
|
||||||
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
|
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
|
||||||
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
|
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
|
||||||
float(scale_(0.5 * print.config().extruder_clearance_max_radius.value - EPSILON)),
|
float(scale_(0.5 * print.config().extruder_clearance_max_radius.value - EPSILON)),
|
||||||
jtRound, scale_(0.1)).front();
|
jtRound, scale_(0.1));
|
||||||
// instance.shift is a position of a centered object, while model object may not be centered.
|
if (!tmp.empty()) { // tmp may be empty due to clipper's bug, see STUDIO-2452
|
||||||
// Convert the shift from the PrintObject's coordinates into ModelObject's coordinates by removing the centering offset.
|
convex_hull = tmp.front();
|
||||||
convex_hull.translate(instance.shift - print_object->center_offset());
|
// instance.shift is a position of a centered object, while model object may not be centered.
|
||||||
|
// Convert the shift from the PrintObject's coordinates into ModelObject's coordinates by removing the centering offset.
|
||||||
|
convex_hull.translate(instance.shift - print_object->center_offset());
|
||||||
|
}
|
||||||
convex_hull_no_offset.translate(instance.shift - print_object->center_offset());
|
convex_hull_no_offset.translate(instance.shift - print_object->center_offset());
|
||||||
//juedge the exclude area
|
//juedge the exclude area
|
||||||
if (!intersection(exclude_polys, convex_hull_no_offset).empty()) {
|
if (!intersection(exclude_polys, convex_hull_no_offset).empty()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue