From 8d046a577ab218b2c84cc9cbcc50848da935181e Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 16 Nov 2021 14:52:07 +0100 Subject: [PATCH 1/5] Fixed wrong color of toolpaths in pre-gcode preview --- src/slic3r/GUI/GLCanvas3D.cpp | 53 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8af4098d6b..ee1db48025 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5095,36 +5095,35 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type) m_camera_clipping_plane = m_gizmos.get_clipping_plane(); - if (m_picking_enabled) { + if (m_picking_enabled) // Update the layer editing selection to the first object selected, update the current object maximum Z. m_layers_editing.select_object(*m_model, this->is_layers_editing_enabled() ? m_selection.get_object_idx() : -1); - if (const BuildVolume &build_volume = m_bed.build_volume(); build_volume.valid()) { - switch (build_volume.type()) { - case BuildVolume::Type::Rectangle: { - const BoundingBox3Base bed_bb = build_volume.bounding_volume().inflated(BuildVolume::SceneEpsilon); - m_volumes.set_print_volume({ 0, // circle - { float(bed_bb.min.x()), float(bed_bb.min.y()), float(bed_bb.max.x()), float(bed_bb.max.y()) }, - { 0.0f, float(build_volume.max_print_height()) } }); - break; - } - case BuildVolume::Type::Circle: { - m_volumes.set_print_volume({ 1, // rectangle - { unscaled(build_volume.circle().center.x()), unscaled(build_volume.circle().center.y()), unscaled(build_volume.circle().radius + BuildVolume::SceneEpsilon), 0.0f }, - { 0.0f, float(build_volume.max_print_height() + BuildVolume::SceneEpsilon) } }); - break; - } - default: - case BuildVolume::Type::Custom: { - m_volumes.set_print_volume({ static_cast(type), - { 0.0f, 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f } }); - } - } - if (m_requires_check_outside_state) { - m_volumes.check_outside_state(build_volume, nullptr); - m_requires_check_outside_state = false; - } + if (const BuildVolume &build_volume = m_bed.build_volume(); build_volume.valid()) { + switch (build_volume.type()) { + case BuildVolume::Type::Rectangle: { + const BoundingBox3Base bed_bb = build_volume.bounding_volume().inflated(BuildVolume::SceneEpsilon); + m_volumes.set_print_volume({ 0, // circle + { float(bed_bb.min.x()), float(bed_bb.min.y()), float(bed_bb.max.x()), float(bed_bb.max.y()) }, + { 0.0f, float(build_volume.max_print_height()) } }); + break; + } + case BuildVolume::Type::Circle: { + m_volumes.set_print_volume({ 1, // rectangle + { unscaled(build_volume.circle().center.x()), unscaled(build_volume.circle().center.y()), unscaled(build_volume.circle().radius + BuildVolume::SceneEpsilon), 0.0f }, + { 0.0f, float(build_volume.max_print_height() + BuildVolume::SceneEpsilon) } }); + break; + } + default: + case BuildVolume::Type::Custom: { + m_volumes.set_print_volume({ static_cast(type), + { 0.0f, 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f } }); + } + } + if (m_requires_check_outside_state) { + m_volumes.check_outside_state(build_volume, nullptr); + m_requires_check_outside_state = false; } } From 0420f63540eca9624037122598e3b0146f214911 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 16 Nov 2021 15:48:06 +0100 Subject: [PATCH 2/5] 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 }; From e063fe920e68965ce87fc0b3b9772a64ded9215a Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Tue, 16 Nov 2021 15:59:43 +0100 Subject: [PATCH 3/5] Fix of the last commit, G-code resolution was increased 10x by mistake. --- src/libslic3r/GCodeWriter.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp index 85137919ce..e8a54737e0 100644 --- a/src/libslic3r/GCodeWriter.hpp +++ b/src/libslic3r/GCodeWriter.hpp @@ -109,7 +109,7 @@ public: // 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 +#if 1 static constexpr const int XYZF_EXPORT_DIGITS = 3; static constexpr const int E_EXPORT_DIGITS = 5; #else From a2c3a6ac2f5d020bde91662630215fdd9e709073 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 16 Nov 2021 16:08:16 +0100 Subject: [PATCH 4/5] Added missing includes (gcc9.4 without pch) --- src/libslic3r/BuildVolume.cpp | 2 ++ src/libslic3r/BuildVolume.hpp | 5 ++++- src/libslic3r/ExPolygonCollection.cpp | 1 + src/libslic3r/Geometry/ConvexHull.cpp | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/BuildVolume.cpp b/src/libslic3r/BuildVolume.cpp index 213c4468d6..216b61698a 100644 --- a/src/libslic3r/BuildVolume.cpp +++ b/src/libslic3r/BuildVolume.cpp @@ -4,6 +4,8 @@ #include "GCode/GCodeProcessor.hpp" #include "Point.hpp" +#include + namespace Slic3r { BuildVolume::BuildVolume(const std::vector &bed_shape, const double max_print_height) : m_bed_shape(bed_shape), m_max_print_height(max_print_height) diff --git a/src/libslic3r/BuildVolume.hpp b/src/libslic3r/BuildVolume.hpp index 39e994f006..ff3041eb7d 100644 --- a/src/libslic3r/BuildVolume.hpp +++ b/src/libslic3r/BuildVolume.hpp @@ -3,6 +3,9 @@ #include "Point.hpp" #include "Geometry/Circle.hpp" +#include "Polygon.hpp" +#include "BoundingBox.hpp" +#include #include @@ -49,7 +52,7 @@ public: const BoundingBox& bounding_box() const { return m_bbox; } // Bounding volume of bed_shape(), max_print_height(), unscaled. const BoundingBoxf3& bounding_volume() const { return m_bboxf; } - BoundingBoxf bounding_volume2d() const { return { to_2d(m_bboxf.min), to_2d(m_bboxf.max) }; }; + BoundingBoxf bounding_volume2d() const { return { to_2d(m_bboxf.min), to_2d(m_bboxf.max) }; } // Center of the print bed, unscaled. Vec2d bed_center() const { return to_2d(m_bboxf.center()); } diff --git a/src/libslic3r/ExPolygonCollection.cpp b/src/libslic3r/ExPolygonCollection.cpp index 1359c799a3..a0de8f6de6 100644 --- a/src/libslic3r/ExPolygonCollection.cpp +++ b/src/libslic3r/ExPolygonCollection.cpp @@ -1,5 +1,6 @@ #include "ExPolygonCollection.hpp" #include "Geometry/ConvexHull.hpp" +#include "BoundingBox.hpp" namespace Slic3r { diff --git a/src/libslic3r/Geometry/ConvexHull.cpp b/src/libslic3r/Geometry/ConvexHull.cpp index 80b417e61a..b1ff77f801 100644 --- a/src/libslic3r/Geometry/ConvexHull.cpp +++ b/src/libslic3r/Geometry/ConvexHull.cpp @@ -1,5 +1,6 @@ #include "libslic3r.h" #include "ConvexHull.hpp" +#include "BoundingBox.hpp" #include From 2c31755bc9e9a1d0215a80c2b9ca0eea0b9c4c0e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 16 Nov 2021 16:09:05 +0100 Subject: [PATCH 5/5] Do not use __FILE__ macro (#7293) --- src/slic3r/GUI/SendSystemInfoDialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/SendSystemInfoDialog.cpp b/src/slic3r/GUI/SendSystemInfoDialog.cpp index fb3205af3c..9db272d351 100644 --- a/src/slic3r/GUI/SendSystemInfoDialog.cpp +++ b/src/slic3r/GUI/SendSystemInfoDialog.cpp @@ -563,11 +563,8 @@ SendSystemInfoDialog::SendSystemInfoDialog(wxWindow* parent) + (is_alpha ? "Alpha" : is_beta ? "Beta" : ""); } - // Get current source file name. - std::string filename(__FILE__); - size_t last_slash_idx = filename.find_last_of("/\\"); - if (last_slash_idx != std::string::npos) - filename = filename.substr(last_slash_idx+1); + const char* filename = "SendSystemInfoDialog.cpp"; + assert(strstr(__FILE__, filename)); // Set dialog background color, fonts, etc. SetFont(wxGetApp().normal_font());