ENH: using shared area for fillbeds when obj is small

when obj is small, it uses the full build volume to compute the empty cell
we need to use the shared one
jira: STUDIO-9583

Change-Id: I4cc183df38e054a7b94579637a49168c2fb77992
(cherry picked from commit fea423cdad4ee1a24c077cfeed99962e89953d5b)
(cherry picked from commit 06d483ee462f6b1a7a3f39805c81ac0b6f0dfcca)
This commit is contained in:
lane.wei
2025-01-11 16:34:12 +08:00
committed by Noisyfox
parent c015a56f24
commit 42c1005e76
5 changed files with 25 additions and 11 deletions

View File

@@ -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);