mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-25 15:47:25 +08:00
Minimum z of object to lay on the bed after rotations. Fixes #1093
This commit is contained in:
parent
3f6d3b903d
commit
df201d65f4
@ -1109,8 +1109,22 @@ void ModelObject::scale(const Pointf3 &versor)
|
|||||||
|
|
||||||
void ModelObject::rotate(float angle, const Axis &axis)
|
void ModelObject::rotate(float angle, const Axis &axis)
|
||||||
{
|
{
|
||||||
|
float min_z = FLT_MAX;
|
||||||
for (ModelVolume *v : this->volumes)
|
for (ModelVolume *v : this->volumes)
|
||||||
|
{
|
||||||
v->mesh.rotate(angle, axis);
|
v->mesh.rotate(angle, axis);
|
||||||
|
min_z = std::min(min_z, v->mesh.stl.stats.min.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (min_z != 0.0f)
|
||||||
|
{
|
||||||
|
// translate the object so that its minimum z lays on the bed
|
||||||
|
for (ModelVolume *v : this->volumes)
|
||||||
|
{
|
||||||
|
v->mesh.translate(0.0f, 0.0f, -min_z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->origin_translation = Pointf3(0, 0, 0);
|
this->origin_translation = Pointf3(0, 0, 0);
|
||||||
this->invalidate_bounding_box();
|
this->invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user