diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 0ad7e45a1..b507a8530 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -927,8 +927,15 @@ template void remove_large_items(std::vector &items, Bin &&bin) template Radians min_area_boundingbox_rotation(const S &sh) { - return minAreaBoundingBox, boost::rational>(sh) - .angleToX(); + try { + return minAreaBoundingBox, boost::rational>(sh) + .angleToX(); + } + catch (const std::exception& e) { + // min_area_boundingbox_rotation may throw exception of dividing 0 if the object is already perfectly aligned to X + BOOST_LOG_TRIVIAL(error) << "arranging min_area_boundingbox_rotation fails, msg=" << e.what(); + return 0.0; + } } template