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/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..e8a54737e0 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 1 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/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 diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 8eb481f7bb..0fd8201ea1 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 }; 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; } } 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());