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)
This commit is contained in:
lane.wei 2024-03-01 12:12:21 +08:00 committed by Lane.Wei
parent 1af1dc0b89
commit 07f965313a
3 changed files with 7 additions and 3 deletions

View File

@ -783,7 +783,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
break; 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<double>(height)); too_tall_instances[inst] = std::make_pair(print_instance_with_bounding_box[k].hull_polygon, unscaled<double>(height));
} }

View File

@ -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. // 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. // The height is snug.
coord_t height() const { return m_size.z(); } 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. // Centering offset of the sliced mesh from the scaled and rotated mesh of the model.
const Point& center_offset() const { return m_center_offset; } const Point& center_offset() const { return m_center_offset; }
@ -498,6 +499,7 @@ private:
// XYZ in scaled coordinates // XYZ in scaled coordinates
Vec3crd m_size; Vec3crd m_size;
double m_max_z;
PrintObjectConfig m_config; PrintObjectConfig m_config;
// Translation in Z + Rotation + Scaling / Mirroring. // Translation in Z + Rotation + Scaling / Mirroring.
Transform3d m_trafo = Transform3d::Identity(); Transform3d m_trafo = Transform3d::Identity();

View File

@ -70,6 +70,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Transfor
// snug height and an approximate bounding box in XY. // snug height and an approximate bounding box in XY.
BoundingBoxf3 bbox = model_object->raw_bounding_box(); BoundingBoxf3 bbox = model_object->raw_bounding_box();
Vec3d bbox_center = bbox.center(); Vec3d bbox_center = bbox.center();
// We may need to rotate the bbox / bbox_center from the original instance to the current instance. // 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()); 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) { 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()); 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. // 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<coord_t>(); m_size = (bbox.size() * (1. / SCALING_FACTOR)).cast<coord_t>();
m_max_z = scaled(model_object->instance_bounding_box(0).max(2));
this->set_instances(std::move(instances)); this->set_instances(std::move(instances));
} }