From 2a2fe3d660ba86ac7a8ca1f1d5b31469d3d8c75f Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Fri, 28 Aug 2026 11:53:44 +0800 Subject: [PATCH] Use PartPlate's m_height to allow CLI to perform proper BuildVolume check --- src/slic3r/GUI/PartPlate.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index ce9cdaa5d2..dddf4cc7d9 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -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 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 - // m_plater is null in CLI mode. - if (m_plater && 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(), m_extruder_areas, m_extruder_heights); - 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) + // For sinking object, we use a more expensive algorithm so part below build plate won't be considered. + // m_height mirrors the printer's printable height independent of m_plater, so this runs in CLI too. + if (plate_box.intersects(instance_box)) { + // TODO: FIXME: this does not take exclusion area into account + const BuildVolume build_volume(get_shape(), m_height, m_extruder_areas, m_extruder_heights); + 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) { Polygon hull = instance->convex_hull_2d(); int index; @@ -2800,9 +2797,9 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi } else outside = false; - } + } - return outside; + return outside; } //judge whether instance is intesected with plate or not