diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 770d02a7c..d6f0d9e0d 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -686,9 +686,11 @@ static std::vector print_objects_from_model_object(const ModelOb trafo.copies.assign(1, Point()); for (ModelInstance *model_instance : model_object.instances) if (model_instance->is_printable()) { - const Vec3d &offst = model_instance->get_offset(); - trafo.trafo = model_instance->world_matrix(true); - trafo.copies.front() = Point::new_scale(offst(0), offst(1)); + trafo.trafo = model_instance->world_matrix(); + // Set the Z axis of the transformation. + trafo.copies.front() = Point::new_scale(trafo.trafo.data()[3], trafo.trafo.data()[7]); + trafo.trafo.data()[3] = 0; + trafo.trafo.data()[7] = 0; auto it = trafos.find(trafo); if (it == trafos.end()) trafos.emplace(trafo); diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index d2dc81755..3c2a87c74 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -135,14 +135,16 @@ public: bool invalidated = false; for (size_t i = 0; i < COUNT; ++ i) if (m_state[i].load(std::memory_order_relaxed) != INVALID) { - if (! invalidated) { - mtx.unlock(); - cancel(); - mtx.lock(); - invalidated = true; - } - m_state[i].store(INVALID, std::memory_order_relaxed); + invalidated = true; + break; } + if (invalidated) { + mtx.unlock(); + cancel(); + for (size_t i = 0; i < COUNT; ++ i) + m_state[i].store(INVALID, std::memory_order_relaxed); + mtx.lock(); + } return invalidated; } diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 6527a7272..8f9146766 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1604,8 +1604,8 @@ std::vector PrintObject::_slice_volumes(const std::vector &z, mesh.merge(v->mesh); if (mesh.stl.stats.number_of_facets > 0) { mesh.transform(m_trafo.cast()); - // align mesh to Z = 0 (it should be already aligned actually) and apply XY shift - mesh.translate(- unscale(m_copies_shift(0)), - unscale(m_copies_shift(1)), - float(this->model_object()->bounding_box().min(2))); + // apply XY shift + mesh.translate(- unscale(m_copies_shift(0)), - unscale(m_copies_shift(1)), 0); // perform actual slicing TriangleMeshSlicer mslicer; const Print *print = this->print();