diff --git a/resources/profiles/Artillery/genius_thumbnail.png b/resources/profiles/Artillery/Genius_thumbnail.png similarity index 100% rename from resources/profiles/Artillery/genius_thumbnail.png rename to resources/profiles/Artillery/Genius_thumbnail.png diff --git a/resources/profiles/Artillery/x1_thumbnail.png b/resources/profiles/Artillery/X1_thumbnail.png similarity index 100% rename from resources/profiles/Artillery/x1_thumbnail.png rename to resources/profiles/Artillery/X1_thumbnail.png diff --git a/src/libnest2d/include/libnest2d/geometry_traits_nfp.hpp b/src/libnest2d/include/libnest2d/geometry_traits_nfp.hpp index 29a1ccd04..6b3ff60c1 100644 --- a/src/libnest2d/include/libnest2d/geometry_traits_nfp.hpp +++ b/src/libnest2d/include/libnest2d/geometry_traits_nfp.hpp @@ -220,7 +220,9 @@ inline NfpResult nfpConvexOnly(const RawShape& sh, auto next = std::next(first); while(next != sl::cend(sh)) { - edgelist.emplace_back(*(first), *(next)); + if (pl::magnsq(*next - *first) > 0) + edgelist.emplace_back(*(first), *(next)); + ++first; ++next; } } @@ -230,7 +232,9 @@ inline NfpResult nfpConvexOnly(const RawShape& sh, auto next = std::next(first); while(next != sl::cend(other)) { - edgelist.emplace_back(*(next), *(first)); + if (pl::magnsq(*next - *first) > 0) + edgelist.emplace_back(*(next), *(first)); + ++first; ++next; } } diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index d6b2cff8e..303ffe927 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -57,6 +57,8 @@ #define ENABLE_GCODE_WINDOW (1 && ENABLE_2_4_0_ALPHA0) // Enable exporting lines M73 for remaining time to next printer stop to gcode #define ENABLE_EXTENDED_M73_LINES (1 && ENABLE_VALIDATE_CUSTOM_GCODE) +// Enable a modified version of automatic downscale on load of objects too big +#define ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG (1 && ENABLE_2_4_0_ALPHA0) #endif // _prusaslicer_technologies_h_ diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e0a5031c2..50adb89e4 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2407,6 +2407,29 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs &mode #endif /* AUTOPLACEMENT_ON_LOAD */ } +#if ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG + for (size_t i = 0; i < object->instances.size(); ++i) { + ModelInstance* instance = object->instances[i]; + const Vec3d size = object->instance_bounding_box(i).size(); + const Vec3d ratio = size.cwiseQuotient(bed_size); + const double max_ratio = std::max(ratio(0), ratio(1)); + if (max_ratio > 10000) { + // the size of the object is too big -> this could lead to overflow when moving to clipper coordinates, + // so scale down the mesh + double inv = 1. / max_ratio; + object->scale_mesh_after_creation(inv * Vec3d::Ones()); + object->origin_translation = Vec3d::Zero(); + object->center_around_origin(); + scaled_down = true; + break; + } + else if (max_ratio > 5) { + const Vec3d inverse = 1.0 / max_ratio * Vec3d::Ones(); + instance->set_scaling_factor(inverse.cwiseProduct(instance->get_scaling_factor())); + scaled_down = true; + } + } +#else const Vec3d size = object->bounding_box().size(); const Vec3d ratio = size.cwiseQuotient(bed_size); const double max_ratio = std::max(ratio(0), ratio(1)); @@ -2425,6 +2448,7 @@ std::vector Plater::priv::load_model_objects(const ModelObjectPtrs &mode } scaled_down = true; } +#endif // ENABLE_MODIFIED_DOWNSCALE_ON_LOAD_OBJECTS_TOO_BIG object->ensure_on_bed(); }