Use PartPlate's m_height to allow CLI to perform proper BuildVolume check

This commit is contained in:
Hanif Koh
2026-08-28 11:53:44 +08:00
parent 9f8d943b05
commit 2a2fe3d660

View File

@@ -2770,19 +2770,16 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi
plate_box.min.z() += instance_box.min.z(); // not considering outsize if sinking plate_box.min.z() += instance_box.min.z(); // not considering outsize if sinking
if (instance_box.min.z() < SINKING_Z_THRESHOLD) { 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 // For sinking object, we use a more expensive algorithm so part below build plate won't be considered.
// m_plater is null in CLI mode. // m_height mirrors the printer's printable height independent of m_plater, so this runs in CLI too.
if (m_plater && plate_box.intersects(instance_box)) { if (plate_box.intersects(instance_box)) {
// TODO: FIXME: this does not take exclusion area into account // TODO: FIXME: this does not take exclusion area into account
const BuildVolume build_volume(get_shape(), m_plater->build_volume().printable_height(), m_extruder_areas, m_extruder_heights); const BuildVolume build_volume(get_shape(), m_height, m_extruder_areas, m_extruder_heights);
const auto state = instance->calc_print_volume_state(build_volume); const auto state = instance->calc_print_volume_state(build_volume);
outside = state == ModelInstancePVS_Partly_Outside; outside = state == ModelInstancePVS_Partly_Outside;
} }
} } else if (plate_box.contains(instance_box)) {
else if (m_exclude_bounding_box.size() > 0)
if (plate_box.contains(instance_box))
{
if (m_exclude_bounding_box.size() > 0)
{ {
Polygon hull = instance->convex_hull_2d(); Polygon hull = instance->convex_hull_2d();
int index; int index;
@@ -2800,9 +2797,9 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi
} }
else else
outside = false; outside = false;
} }
return outside; return outside;
} }
//judge whether instance is intesected with plate or not //judge whether instance is intesected with plate or not