From cd2cccec5f2ff20fa06b8f66472656671032c616 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 18 Mar 2019 15:31:47 +0100 Subject: [PATCH] Adding validation code for support parameters (elevation) --- src/libslic3r/SLA/SLASupportTree.cpp | 4 ++-- src/libslic3r/SLAPrint.cpp | 17 +++++++++++++++++ src/libslic3r/SLAPrint.hpp | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/SLA/SLASupportTree.cpp b/src/libslic3r/SLA/SLASupportTree.cpp index 650dfe2e79..df9990822d 100644 --- a/src/libslic3r/SLA/SLASupportTree.cpp +++ b/src/libslic3r/SLA/SLASupportTree.cpp @@ -1466,7 +1466,7 @@ public: m_cfg.head_back_radius_mm, w); - if(t <= w || (hp(Z) + nn(Z) * w) < m_result.ground_level) { + if(t <= w) { // Let's try to optimize this angle, there might be a // viable normal that doesn't collide with the model @@ -1509,7 +1509,7 @@ public: // save the verified and corrected normal m_support_nmls.row(fidx) = nn; - if(t > w && (hp(Z) + nn(Z) * w) > m_result.ground_level) { + if(t > w) { // mark the point for needing a head. m_iheads.emplace_back(fidx); } else if( polar >= 3*PI/4 ) { diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 0e8e717cc6..83fa61fdd0 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -571,7 +571,24 @@ void swapXY(ExPolygon& expoly) { for(auto& p : expoly.contour.points) std::swap(p(X), p(Y)); for(auto& h : expoly.holes) for(auto& p : h.points) std::swap(p(X), p(Y)); } +} +std::string SLAPrint::validate() const +{ + for(SLAPrintObject * po : m_objects) { + sla::SupportConfig cfg = make_support_cfg(po->config()); + + double pinhead_width = + 2 * cfg.head_front_radius_mm + + cfg.head_width_mm + + 2 * cfg.head_back_radius_mm - + cfg.head_penetration_mm; + + if(pinhead_width > cfg.object_elevation_mm) + return L("Elevetion is too low for object."); + } + + return ""; } std::vector SLAPrint::calculate_heights(const BoundingBoxf3& bb3d, diff --git a/src/libslic3r/SLAPrint.hpp b/src/libslic3r/SLAPrint.hpp index eb927c769d..c06e2fc777 100644 --- a/src/libslic3r/SLAPrint.hpp +++ b/src/libslic3r/SLAPrint.hpp @@ -240,6 +240,8 @@ public: const SLAPrintStatistics& print_statistics() const { return m_print_statistics; } + std::string validate() const override; + private: using SLAPrinter = FilePrinter; using SLAPrinterPtr = std::unique_ptr;