ENH: accurate top z distance for tree support

1. accurate top z distance for tree support
 Also fix a bug that bottom z and top z distances are misused.
    jira: STUDIO-3000, STUDIO-5990
    github: #1827
2. Change interface pattern to interlaced rectilinear when using
support material.
2. clean up tree support code

Change-Id: Icc8ce1b6844c841a6fbd1d623df707fdc8ed0f7b
(cherry picked from commit da7412a48dfb5767918ef125b9d0fb9718c03a61)
(cherry picked from commit 39ae64fc53abec794d740e36baaa13fd6fb35849)
This commit is contained in:
Arthur 2024-01-06 21:27:46 +08:00 committed by Noisyfox
parent de24d0ac2f
commit d0868d6711
8 changed files with 365 additions and 372 deletions

View file

@ -6,6 +6,7 @@
#include <ctime>
#include <cstdarg>
#include <stdio.h>
#include <filesystem>
#include "format.hpp"
#include "Platform.hpp"
@ -298,12 +299,13 @@ static std::atomic<bool> debug_out_path_called(false);
std::string debug_out_path(const char *name, ...)
{
static constexpr const char *SLIC3R_DEBUG_OUT_PATH_PREFIX = "out/";
//static constexpr const char *SLIC3R_DEBUG_OUT_PATH_PREFIX = "out/";
auto svg_folder = boost::filesystem::path(g_data_dir) / "SVG/";
if (! debug_out_path_called.exchange(true)) {
std::string path = boost::filesystem::system_complete(SLIC3R_DEBUG_OUT_PATH_PREFIX).string();
if (!boost::filesystem::exists(path)) {
boost::filesystem::create_directory(path);
if (!boost::filesystem::exists(svg_folder)) {
boost::filesystem::create_directory(svg_folder);
}
std::string path = boost::filesystem::system_complete(svg_folder).string();
printf("Debugging output files will be written to %s\n", path.c_str());
}
char buffer[2048];
@ -311,7 +313,13 @@ std::string debug_out_path(const char *name, ...)
va_start(args, name);
std::vsprintf(buffer, name, args);
va_end(args);
return std::string(SLIC3R_DEBUG_OUT_PATH_PREFIX) + std::string(buffer);
std::string buf(buffer);
if (size_t pos = buf.find_first_of('/'); pos != std::string::npos) {
std::string sub_dir = buf.substr(0, pos);
std::filesystem::create_directory(svg_folder.string() + sub_dir);
}
return svg_folder.string() + std::string(buffer);
}
namespace logging = boost::log;