From 07f965313a03af78c3a62dae454a4432870bae5a Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Fri, 1 Mar 2024 12:12:21 +0800 Subject: [PATCH] FIX: seq_print: fix an invalid warning caused by sinking github: https://github.com/bambulab/BambuStudio/issues/3007 Change-Id: I1111910f2c625d5a871ea01b37dbfa7b04a849ee (cherry picked from commit a3db95bb0940d5afe07ef0bb07113cc2acd7cd0a) --- src/libslic3r/Print.cpp | 6 +++--- src/libslic3r/Print.hpp | 2 ++ src/libslic3r/PrintObject.cpp | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index f57eb70f7..b02c4882d 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -233,7 +233,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "prime_tower_brim_width" || opt_key == "first_layer_print_sequence" || opt_key == "other_layers_print_sequence" - || opt_key == "other_layers_print_sequence_nums" + || opt_key == "other_layers_print_sequence_nums" //|| opt_key == "wipe_tower_bridging" || opt_key == "wipe_tower_no_sparse_layers" || opt_key == "flush_volumes_matrix" @@ -783,7 +783,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print break; } } - if (height < inst->print_object->height()) + if (height < inst->print_object->max_z()) too_tall_instances[inst] = std::make_pair(print_instance_with_bounding_box[k].hull_polygon, unscaled(height)); } @@ -1050,7 +1050,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons* PrintObject::update_layer_height_profile(*print_object.model_object(), print_object.slicing_parameters(), profile); return profile; }; - + // Custom layering is not allowed for tree supports as of now. for (size_t print_object_idx = 0; print_object_idx < m_objects.size(); ++ print_object_idx) diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index 7f3913487..82a57a389 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -328,6 +328,7 @@ public: // Height is used for slicing, for sorting the objects by height for sequential printing and for checking vertical clearence in sequential print mode. // The height is snug. coord_t height() const { return m_size.z(); } + double max_z() const { return m_max_z; } // Centering offset of the sliced mesh from the scaled and rotated mesh of the model. const Point& center_offset() const { return m_center_offset; } @@ -498,6 +499,7 @@ private: // XYZ in scaled coordinates Vec3crd m_size; + double m_max_z; PrintObjectConfig m_config; // Translation in Z + Rotation + Scaling / Mirroring. Transform3d m_trafo = Transform3d::Identity(); diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 44a789720..cafb9bd8c 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -70,6 +70,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Transfor // snug height and an approximate bounding box in XY. BoundingBoxf3 bbox = model_object->raw_bounding_box(); Vec3d bbox_center = bbox.center(); + // We may need to rotate the bbox / bbox_center from the original instance to the current instance. double z_diff = Geometry::rotation_diff_z(model_object->instances.front()->get_rotation(), instances.front().model_instance->get_rotation()); if (std::abs(z_diff) > EPSILON) { @@ -82,6 +83,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Transfor m_center_offset = Point::new_scale(bbox_center.x(), bbox_center.y()); // Size of the transformed mesh. This bounding may not be snug in XY plane, but it is snug in Z. m_size = (bbox.size() * (1. / SCALING_FACTOR)).cast(); + m_max_z = scaled(model_object->instance_bounding_box(0).max(2)); this->set_instances(std::move(instances)); }