From 18beb10ae0b7040b4c97b003674f465dadffda4d Mon Sep 17 00:00:00 2001
From: bubnikv <bubnikv@gmail.com>
Date: Sat, 22 Dec 2018 10:55:15 +0100
Subject: [PATCH] Automatic SLA support points: Disable debug outputs by
 default.

---
 src/libslic3r/SLA/SLAAutoSupports.cpp | 9 ++++++++-
 src/libslic3r/SLA/SLAAutoSupports.hpp | 4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/libslic3r/SLA/SLAAutoSupports.cpp b/src/libslic3r/SLA/SLAAutoSupports.cpp
index 5011c485b..8f8d5673a 100644
--- a/src/libslic3r/SLA/SLAAutoSupports.cpp
+++ b/src/libslic3r/SLA/SLAAutoSupports.cpp
@@ -171,7 +171,7 @@ float SLAAutoSupports::distance_limit(float angle) const
     return 1./(2.4*get_required_density(angle));
 }
 
-
+#ifdef SLA_AUTOSUPPORTS_DEBUG
 void SLAAutoSupports::output_expolygons(const ExPolygons& expolys, std::string filename) const
 {
     BoundingBox bb(Point(-30000000, -30000000), Point(30000000, 30000000));
@@ -188,6 +188,7 @@ void SLAAutoSupports::output_expolygons(const ExPolygons& expolys, std::string f
         svg_cummulative.draw_outline(expolys[i].holes, "blue", scale_(0.05));
     }
 }
+#endif /* SLA_AUTOSUPPORTS_DEBUG */
 
 std::vector<std::pair<ExPolygon, coord_t>> SLAAutoSupports::find_islands(const std::vector<ExPolygons>& slices, const std::vector<float>& heights) const
 {
@@ -203,10 +204,14 @@ std::vector<std::pair<ExPolygon, coord_t>> SLAAutoSupports::find_islands(const s
         const ExPolygons& expolys_bottom = (i == 0 ? ExPolygons() : slices[i-1]);
 
         std::string layer_num_str = std::string((i<10 ? "0" : "")) + std::string((i<100 ? "0" : "")) + std::to_string(i);
+#ifdef SLA_AUTOSUPPORTS_DEBUG
         output_expolygons(expolys_top, "top" + layer_num_str + ".svg");
+#endif /* SLA_AUTOSUPPORTS_DEBUG */
         ExPolygons diff = diff_ex(expolys_top, expolys_bottom);
 
+#ifdef SLA_AUTOSUPPORTS_DEBUG
         output_expolygons(diff, "diff" + layer_num_str + ".svg");
+#endif /* SLA_AUTOSUPPORTS_DEBUG */
 
         ClosestPointLookupType cpl(SCALED_EPSILON);
         for (const ExPolygon& expol : expolys_top) {
@@ -240,8 +245,10 @@ std::vector<std::pair<ExPolygon, coord_t>> SLAAutoSupports::find_islands(const s
             NO_ISLAND: ;// continue with next ExPolygon
         }
 
+#ifdef SLA_AUTOSUPPORTS_DEBUG
         //if (!islands.empty())
           //  output_expolygons(islands, "islands" + layer_num_str + ".svg");
+#endif /* SLA_AUTOSUPPORTS_DEBUG */
     }
 
     return islands;
diff --git a/src/libslic3r/SLA/SLAAutoSupports.hpp b/src/libslic3r/SLA/SLAAutoSupports.hpp
index 568c200d0..08dc45236 100644
--- a/src/libslic3r/SLA/SLAAutoSupports.hpp
+++ b/src/libslic3r/SLA/SLAAutoSupports.hpp
@@ -5,7 +5,7 @@
 #include <libslic3r/TriangleMesh.hpp>
 #include <libslic3r/SLA/SLASupportTree.hpp>
 
-
+// #define SLA_AUTOSUPPORTS_DEBUG
 
 namespace Slic3r {
 
@@ -33,7 +33,9 @@ private:
     std::vector<Vec3d> uniformly_cover(const std::pair<ExPolygon, coord_t>& island);
     void project_upward_onto_mesh(std::vector<Vec3d>& points) const;
 
+#ifdef SLA_AUTOSUPPORTS_DEBUG
     void output_expolygons(const ExPolygons& expolys, std::string filename) const;
+#endif /* SLA_AUTOSUPPORTS_DEBUG */
 
     SLAAutoSupports::Config m_config;
     const Eigen::MatrixXd& m_V;