diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 7ec6c1fba0..69acfef49e 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -9748,7 +9748,7 @@ static Points to_points(const std::vector &dpts) return pts; } -static Polygon get_shared_poly(const std::vector& extruder_polys) +Polygon get_shared_poly(const std::vector& extruder_polys) { Polygon result; for (int index = 0; index < extruder_polys.size(); index++) diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 9aed054a6e..e8a14c40af 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1869,6 +1869,7 @@ private: bool is_XL_printer(const DynamicPrintConfig &cfg); bool is_XL_printer(const PrintConfig &cfg); +Polygon get_shared_poly(const std::vector& extruder_polys); Points get_bed_shape(const DynamicPrintConfig &cfg, bool use_share = true); Points get_bed_shape(const PrintConfig &cfg, bool use_share = false); Points get_bed_shape(const SLAPrinterConfig &cfg); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 1459a36612..032d344487 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -2846,6 +2846,27 @@ const BoundingBox PartPlate::get_bounding_box_crd() return plate_shape.bounding_box(); } +BoundingBoxf3 PartPlate::get_build_volume(bool use_share) +{ + auto eps=Slic3r::BuildVolume::SceneEpsilon; + Vec3d up_point; + Vec3d low_point; + if (use_share && !m_extruder_areas.empty()) { + Polygon bed_poly = get_shared_poly(m_extruder_areas); + BoundingBox bbox = bed_poly.bounding_box(); + + up_point = Vec3d(unscale_(bbox.max.x()) + eps, unscale_(bbox.max.y()) + eps, m_origin.z() + m_height + eps); + low_point = Vec3d(unscale_(bbox.min.x()) - eps, unscale_(bbox.min.y()) - eps, m_origin.z() - eps); + } + else { + // Orca: support non-rectangular bed + up_point = m_bounding_box.max + Vec3d(eps, eps, m_origin.z() + m_height + eps); + low_point = m_bounding_box.min + Vec3d(-eps, -eps, m_origin.z() - eps); + } + BoundingBoxf3 plate_box(low_point, up_point); + return plate_box; +} + bool PartPlate::contains(const Vec3d& point) const { return m_bounding_box.contains(point); diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index e5e4b837e8..06d4d682ab 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -401,15 +401,7 @@ public: const BoundingBoxf3& get_bounding_box(bool extended = false) { return extended ? m_extended_bounding_box : m_bounding_box; } const BoundingBox get_bounding_box_crd(); BoundingBoxf3 get_plate_box() {return get_build_volume();} - // Orca: support non-rectangular bed - BoundingBoxf3 get_build_volume() - { - auto eps=Slic3r::BuildVolume::SceneEpsilon; - Vec3d up_point = m_bounding_box.max + Vec3d(eps, eps, m_origin.z() + m_height + eps); - Vec3d low_point = m_bounding_box.min + Vec3d(-eps, -eps, m_origin.z() - eps); - BoundingBoxf3 plate_box(low_point, up_point); - return plate_box; - } + BoundingBoxf3 get_build_volume(bool use_share = false); const std::vector& get_exclude_areas() { return m_exclude_bounding_box; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 57333450ca..9636df60fa 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -15037,7 +15037,7 @@ void Plater::clone_selection() std::vector Plater::get_empty_cells(const Vec2f step) { PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); - BoundingBoxf3 build_volume = plate->get_build_volume(); + BoundingBoxf3 build_volume = plate->get_build_volume(true); Vec2d vmin(build_volume.min.x(), build_volume.min.y()), vmax(build_volume.max.x(), build_volume.max.y()); BoundingBoxf bbox(vmin, vmax); std::vector cells;