Only consider part above plate when checking for object outside (#8456)

Fix #8218

Before:
![image](https://github.com/user-attachments/assets/3fa8bcb0-b0df-4503-b2f7-0ecba99fafab)


After:
![image](https://github.com/user-attachments/assets/f7280b50-42be-4ef1-a53e-12408511a627)
![image](https://github.com/user-attachments/assets/65ffebb7-6d49-4d8a-9dda-4676e4b0953b)


Note: there is still an issue that you still cannot slice if object below plate overlaps exclusion area. It won't be easy to fix and also will be computational costy, so I won't try to solve this in this PR yet.
![image](https://github.com/user-attachments/assets/76cb2f65-6233-47e7-85fe-fd92dd1d2507)
This commit is contained in:
SoftFever
2025-03-30 15:40:44 +08:00
committed by GitHub
4 changed files with 63 additions and 40 deletions

View File

@@ -1077,14 +1077,15 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
{
if (! volume->is_modifier && (volume->shader_outside_printer_detection_enabled || (! volume->is_wipe_tower && volume->composite_id.volume_id >= 0))) {
BuildVolume::ObjectState state;
const BoundingBoxf3& bb = volume_bbox(*volume);
if (volume_below(*volume))
state = BuildVolume::ObjectState::Below;
else {
switch (plate_build_volume.type()) {
case BuildVolume_Type::Rectangle:
//FIXME this test does not evaluate collision of a build volume bounding box with non-convex objects.
case BuildVolume_Type::Rectangle: {
//FIXME this test does not evaluate collision of a build volume bounding box with non-convex objects.
const BoundingBoxf3& bb = volume_bbox(*volume);
state = plate_build_volume.volume_state_bbox(bb);
}
break;
case BuildVolume_Type::Circle:
case BuildVolume_Type::Convex:

View File

@@ -2074,6 +2074,16 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi
if (instance_box.max.z() > plate_box.min.z())
plate_box.min.z() += instance_box.min.z(); // not considering outsize if sinking
if (instance_box.min.z() < SINKING_Z_THRESHOLD) {
// Orca: For sinking object, we use a more expensive algorithm so part below build plate won't be considered
if (plate_box.intersects(instance_box)) {
// TODO: FIXME: this does not take exclusion area into account
const BuildVolume build_volume(get_shape(), m_plater->build_volume().printable_height());
const auto state = instance->calc_print_volume_state(build_volume);
outside = state == ModelInstancePVS_Partly_Outside;
}
}
else
if (plate_box.contains(instance_box))
{
if (m_exclude_bounding_box.size() > 0)