FIX: fitst layer bbox was wrong for multiple plates

brim bounding box is now shifted w.r.t. plate origin, need to modify the
no-brim shift the same way.

Change-Id: Iefa7287e2848aadbfc4a468bca394ecec48a1e7c
This commit is contained in:
Arthur 2023-06-26 11:48:16 +08:00 committed by Lane.Wei
parent 4640cf9a1a
commit 0cad88309c
6 changed files with 21 additions and 22 deletions

View file

@ -1392,7 +1392,7 @@ BoundingBox PrintObject::get_first_layer_bbox(float& a, float& layer_height, std
auto layer = get_layer(0);
layer_height = layer->height;
// only work for object with single instance
auto shift = instances()[0].shift;
auto shift = instances()[0].shift_without_plate_offset();
for (auto bb : layer->lslices_bboxes)
{
bb.translate(shift.x(), shift.y());
@ -3520,4 +3520,12 @@ Polygon PrintInstance::get_convex_hull_2d() {
return poly;
}
//BBS: instance_shift is too large because of multi-plate, apply without plate offset.
Point PrintInstance::shift_without_plate_offset() const
{
const Print* print = print_object->print();
const Vec3d plate_offset = print->get_plate_origin();
return shift - Point(scaled(plate_offset.x()), scaled(plate_offset.y()));
}
} // namespace Slic3r