Follow-up of 763a91e2ca
-> take in account of ModelObject::origin_translation when saving parts and modifiers to stl
This commit is contained in:
parent
88059baddb
commit
a9223aeb5f
@ -273,6 +273,11 @@ void TriangleMesh::translate(float x, float y, float z)
|
|||||||
stl_invalidate_shared_vertices(&this->stl);
|
stl_invalidate_shared_vertices(&this->stl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TriangleMesh::translate(const Vec3f &displacement)
|
||||||
|
{
|
||||||
|
translate(displacement(0), displacement(1), displacement(2));
|
||||||
|
}
|
||||||
|
|
||||||
void TriangleMesh::rotate(float angle, const Axis &axis)
|
void TriangleMesh::rotate(float angle, const Axis &axis)
|
||||||
{
|
{
|
||||||
if (angle == 0.f)
|
if (angle == 0.f)
|
||||||
|
@ -40,6 +40,7 @@ public:
|
|||||||
void scale(float factor);
|
void scale(float factor);
|
||||||
void scale(const Vec3d &versor);
|
void scale(const Vec3d &versor);
|
||||||
void translate(float x, float y, float z);
|
void translate(float x, float y, float z);
|
||||||
|
void translate(const Vec3f &displacement);
|
||||||
void rotate(float angle, const Axis &axis);
|
void rotate(float angle, const Axis &axis);
|
||||||
void rotate(float angle, const Vec3d& axis);
|
void rotate(float angle, const Vec3d& axis);
|
||||||
void rotate_x(float angle) { this->rotate(angle, X); }
|
void rotate_x(float angle) { this->rotate(angle, X); }
|
||||||
|
@ -3380,18 +3380,19 @@ void Plater::export_stl(bool selection_only)
|
|||||||
const auto obj_idx = selection.get_object_idx();
|
const auto obj_idx = selection.get_object_idx();
|
||||||
if (obj_idx == -1) { return; }
|
if (obj_idx == -1) { return; }
|
||||||
|
|
||||||
|
const ModelObject* model_object = p->model.objects[obj_idx];
|
||||||
if (selection.get_mode() == Selection::Instance)
|
if (selection.get_mode() == Selection::Instance)
|
||||||
mesh = p->model.objects[obj_idx]->mesh();
|
mesh = model_object->mesh();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
|
const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
mesh = p->model.objects[obj_idx]->volumes[volume->volume_idx()]->mesh;
|
mesh = model_object->volumes[volume->volume_idx()]->mesh;
|
||||||
mesh.transform(volume->get_volume_transformation().get_matrix());
|
mesh.transform(volume->get_volume_transformation().get_matrix());
|
||||||
|
mesh.translate(-model_object->origin_translation.cast<float>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
mesh = p->model.mesh();
|
mesh = p->model.mesh();
|
||||||
}
|
|
||||||
|
|
||||||
Slic3r::store_stl(path_u8.c_str(), &mesh, true);
|
Slic3r::store_stl(path_u8.c_str(), &mesh, true);
|
||||||
p->statusbar()->set_status_text(wxString::Format(_(L("STL file exported to %s")), path));
|
p->statusbar()->set_status_text(wxString::Format(_(L("STL file exported to %s")), path));
|
||||||
|
Loading…
Reference in New Issue
Block a user