From 0420f63540eca9624037122598e3b0146f214911 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 16 Nov 2021 15:48:06 +0100 Subject: [PATCH] Higher resolution G-code and volumetric rate legend, disabled. --- src/libslic3r/GCodeWriter.cpp | 2 +- src/libslic3r/GCodeWriter.hpp | 14 ++++++++++++++ src/slic3r/GUI/GCodeViewer.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index f57e254061..ce9e19a577 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -536,7 +536,7 @@ std::string GCodeWriter::set_fan(unsigned int speed) const void GCodeFormatter::emit_axis(const char axis, const double v, size_t digits) { assert(digits <= 6); - static constexpr const std::array pow_10{1, 10, 100, 1000, 10000, 100000, 1000000}; + static constexpr const std::array pow_10{1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; *ptr_err.ptr++ = ' '; *ptr_err.ptr++ = axis; char *base_ptr = this->ptr_err.ptr; diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp index 6e2c08d3b5..85137919ce 100644 --- a/src/libslic3r/GCodeWriter.hpp +++ b/src/libslic3r/GCodeWriter.hpp @@ -104,8 +104,22 @@ public: GCodeFormatter(const GCodeFormatter&) = delete; GCodeFormatter& operator=(const GCodeFormatter&) = delete; + // At layer height 0.15mm, extrusion width 0.2mm and filament diameter 1.75mm, + // the crossection of extrusion is 0.4 * 0.15 = 0.06mm2 + // and the filament crossection is 1.75^2 = 3.063mm2 + // thus the filament moves 3.063 / 0.6 = 51x slower than the XY axes + // and we need roughly two decimal digits more on extruder than on XY. +#if 0 static constexpr const int XYZF_EXPORT_DIGITS = 3; static constexpr const int E_EXPORT_DIGITS = 5; +#else + // order of magnitude smaller extrusion rate erros + static constexpr const int XYZF_EXPORT_DIGITS = 4; + static constexpr const int E_EXPORT_DIGITS = 6; + // excessive accuracy +// static constexpr const int XYZF_EXPORT_DIGITS = 6; +// static constexpr const int E_EXPORT_DIGITS = 9; +#endif void emit_axis(const char axis, const double v, size_t digits); diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index a38a0e0eda..2fc5cde2ae 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -520,6 +520,8 @@ const std::vector GCodeViewer::Travel_Colors {{ { 0.505f, 0.064f, 0.028f, 1.0f } // Retract }}; +#if 1 +// Normal ranges const std::vector GCodeViewer::Range_Colors {{ { 0.043f, 0.173f, 0.478f, 1.0f }, // bluish { 0.075f, 0.349f, 0.522f, 1.0f }, @@ -533,6 +535,32 @@ const std::vector GCodeViewer::Range_Colors {{ { 0.761f, 0.322f, 0.235f, 1.0f }, { 0.581f, 0.149f, 0.087f, 1.0f } // reddish }}; +#else +// Detailed ranges +const std::vector GCodeViewer::Range_Colors{ { + { 0.043f, 0.173f, 0.478f, 1.0f }, // bluish + { 0.5f * (0.043f + 0.075f), 0.5f * (0.173f + 0.349f), 0.5f * (0.478f + 0.522f), 1.0f }, + { 0.075f, 0.349f, 0.522f, 1.0f }, + { 0.5f * (0.075f + 0.110f), 0.5f * (0.349f + 0.533f), 0.5f * (0.522f + 0.569f), 1.0f }, + { 0.110f, 0.533f, 0.569f, 1.0f }, + { 0.5f * (0.110f + 0.016f), 0.5f * (0.533f + 0.839f), 0.5f * (0.569f + 0.059f), 1.0f }, + { 0.016f, 0.839f, 0.059f, 1.0f }, + { 0.5f * (0.016f + 0.667f), 0.5f * (0.839f + 0.949f), 0.5f * (0.059f + 0.000f), 1.0f }, + { 0.667f, 0.949f, 0.000f, 1.0f }, + { 0.5f * (0.667f + 0.988f), 0.5f * (0.949f + 0.975f), 0.5f * (0.000f + 0.012f), 1.0f }, + { 0.988f, 0.975f, 0.012f, 1.0f }, + { 0.5f * (0.988f + 0.961f), 0.5f * (0.975f + 0.808f), 0.5f * (0.012f + 0.039f), 1.0f }, + { 0.961f, 0.808f, 0.039f, 1.0f }, + { 0.5f * (0.961f + 0.890f), 0.5f * (0.808f + 0.533f), 0.5f * (0.039f + 0.125f), 1.0f }, + { 0.890f, 0.533f, 0.125f, 1.0f }, + { 0.5f * (0.890f + 0.820f), 0.5f * (0.533f + 0.408f), 0.5f * (0.125f + 0.188f), 1.0f }, + { 0.820f, 0.408f, 0.188f, 1.0f }, + { 0.5f * (0.820f + 0.761f), 0.5f * (0.408f + 0.322f), 0.5f * (0.188f + 0.235f), 1.0f }, + { 0.761f, 0.322f, 0.235f, 1.0f }, + { 0.5f * (0.761f + 0.581f), 0.5f * (0.322f + 0.149f), 0.5f * (0.235f + 0.087f), 1.0f }, + { 0.581f, 0.149f, 0.087f, 1.0f } // reddishgit +} }; +#endif const GCodeViewer::Color GCodeViewer::Wipe_Color = { 1.0f, 1.0f, 0.0f, 1.0f }; const GCodeViewer::Color GCodeViewer::Neutral_Color = { 0.25f, 0.25f, 0.25f, 1.0f };