[CLI]: Fix Plate Config Reading and BuildVolume Height Checks (#15479)

* Fix incorrect early exit for CLI mode no-support preventing parameters from being read

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

* Add safeguard against extruder_pintable_heights and extruder_areas vector size mismatch

* Preserve printable_height precision in PartPlate/PartPlateList

* Fixed multiple BuildVolume warning issue, and keep check_outside diff minimal
This commit is contained in:
HanifKoh
2026-09-04 23:24:59 +08:00
committed by GitHub
parent df30e22427
commit 1170b048e8
7 changed files with 85 additions and 39 deletions

View File

@@ -8,6 +8,7 @@ add_executable(${_TEST_NAME}_tests
test_arachne_walls.cpp
test_arrange.cpp
test_bambu_networking.cpp
test_buildvolume.cpp
test_calib.cpp
test_clipper_offset.cpp
test_clipper_utils.cpp

View File

@@ -0,0 +1,40 @@
#include <catch2/catch_all.hpp>
#include "libslic3r/BuildVolume.hpp"
using namespace Slic3r;
static std::vector<Vec2d> rect_area(double w, double d)
{
return { { 0., 0. }, { w, 0. }, { w, d }, { 0., d } };
}
// extruder_printable_height and extruder_printable_area are independent config options, so a
// profile can leave the heights short. BuildVolume must not index past the end of the heights.
TEST_CASE("BuildVolume falls back to the bed height when extruder_printable_height is short", "[BuildVolume]")
{
const std::vector<Vec2d> bed = rect_area(200., 200.);
const std::vector<std::vector<Vec2d>> areas = { rect_area(200., 200.), rect_area(100., 200.) };
const std::vector<double> heights = { 180. };
const BuildVolume build_volume(bed, 250., areas, heights);
REQUIRE(build_volume.get_extruder_area_count() == 2);
// The extruder with a height of its own keeps it, and differs from the bed, so it gets its own volume.
CHECK_THAT(build_volume.get_extruder_area_volume(0).bboxf.max.z(), Catch::Matchers::WithinAbs(180., 1e-6));
// The extruder without one falls back to the bed's printable_height instead of reading out of range.
CHECK_THAT(build_volume.get_extruder_area_volume(1).bboxf.max.z(), Catch::Matchers::WithinAbs(250., 1e-6));
}
TEST_CASE("BuildVolume keeps per-extruder heights when both vectors match", "[BuildVolume]")
{
const std::vector<Vec2d> bed = rect_area(200., 200.);
const std::vector<std::vector<Vec2d>> areas = { rect_area(120., 200.), rect_area(100., 200.) };
const std::vector<double> heights = { 180., 200.5 };
const BuildVolume build_volume(bed, 250., areas, heights);
REQUIRE(build_volume.get_extruder_area_count() == 2);
CHECK_THAT(build_volume.get_extruder_area_volume(0).bboxf.max.z(), Catch::Matchers::WithinAbs(180., 1e-6));
CHECK_THAT(build_volume.get_extruder_area_volume(1).bboxf.max.z(), Catch::Matchers::WithinAbs(200.5, 1e-6));
}