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

@ -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<double>(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)

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.
// 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();

View File

@ -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<coord_t>();
m_max_z = scaled(model_object->instance_bounding_box(0).max(2));
this->set_instances(std::move(instances));
}