From 8a3d2f385f457f9962e5a14653c2e91b73dcb6ac Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 3 Jan 2019 14:20:01 +0100 Subject: [PATCH] Fix for bad arrange with mirrored objects --- src/libslic3r/ModelArrange.cpp | 5 +++-- src/libslic3r/SLA/SLASupportTree.cpp | 4 +++- src/libslic3r/SLAPrint.cpp | 13 +++++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index 562527290..8ed595802 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -511,8 +511,9 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) { ModelInstance * finst = objptr->instances.front(); // Object instances should carry the same scaling and - // x, y rotation that is why we use the first instance - rmesh.scale(finst->get_scaling_factor()); + // x, y rotation that is why we use the first instance. + // The next line will apply only the full mirroring and scaling + rmesh.transform(finst->get_matrix(true, true, false, false)); rmesh.rotate_x(float(finst->get_rotation()(X))); rmesh.rotate_y(float(finst->get_rotation()(Y))); diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index 11ffc33b0..746acc547 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -1117,7 +1117,9 @@ bool SLASupportTree::generate(const PointSet &points, head_norm.row(pcount) = nn; ++pcount; - } else { + } else if( polar >= 3*PI/4 ) { + // Headless supports do not tilt like the headed ones so + // the normal should point almost to the ground. headless_norm.row(hlcount) = nn; headless_pos.row(hlcount++) = hp; } diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index e2a256b72..f45d805b6 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -502,8 +502,8 @@ void SLAPrint::process() po.m_supportdata.reset(new SLAPrintObject::SupportData()); po.m_supportdata->emesh = sla::to_eigenmesh(po.transformed_mesh()); - BOOST_LOG_TRIVIAL(debug) - << "Support point count " << mo.sla_support_points.size(); + BOOST_LOG_TRIVIAL(debug) << "Support point count " + << mo.sla_support_points.size(); // If there are no points on the front-end, we will do the // autoplacement. Otherwise we will just blindly copy the frontend data @@ -537,6 +537,9 @@ void SLAPrint::process() const std::vector& points = auto_supports.output(); this->throw_if_canceled(); po.m_supportdata->support_points = sla::to_point_set(points); + + BOOST_LOG_TRIVIAL(debug) << "Automatic support points: " + << po.m_supportdata->support_points.rows(); } else { // There are some points on the front-end, no calculation will be done. @@ -584,13 +587,15 @@ void SLAPrint::process() // Create the unified mesh auto rc = SlicingStatus::RELOAD_SCENE; - po.m_supportdata->support_tree_ptr->merged_mesh(); - // Check the mesh for later troubleshooting. + // This is to prevent "Done." being displayed during merged_mesh() + report_status(*this, -1, L("Visualizing supports")); + po.m_supportdata->support_tree_ptr->merged_mesh(); BOOST_LOG_TRIVIAL(debug) << "Processed support point count " << po.m_supportdata->support_points.rows(); + // Check the mesh for later troubleshooting. if(po.support_mesh().empty()) BOOST_LOG_TRIVIAL(warning) << "Support mesh is empty";