Merge branch 'master' into fs_simplify_multipart_object

This commit is contained in:
Filip Sykala 2021-11-16 16:24:14 +01:00
commit dbf000f3be
9 changed files with 79 additions and 34 deletions

View File

@ -4,6 +4,8 @@
#include "GCode/GCodeProcessor.hpp"
#include "Point.hpp"
#include <boost/log/trivial.hpp>
namespace Slic3r {
BuildVolume::BuildVolume(const std::vector<Vec2d> &bed_shape, const double max_print_height) : m_bed_shape(bed_shape), m_max_print_height(max_print_height)

View File

@ -3,6 +3,9 @@
#include "Point.hpp"
#include "Geometry/Circle.hpp"
#include "Polygon.hpp"
#include "BoundingBox.hpp"
#include <admesh/stl.h>
#include <string_view>
@ -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()); }

View File

@ -1,5 +1,6 @@
#include "ExPolygonCollection.hpp"
#include "Geometry/ConvexHull.hpp"
#include "BoundingBox.hpp"
namespace Slic3r {

View File

@ -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<int, 7> pow_10{1, 10, 100, 1000, 10000, 100000, 1000000};
static constexpr const std::array<int, 10> 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;

View File

@ -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);

View File

@ -1,5 +1,6 @@
#include "libslic3r.h"
#include "ConvexHull.hpp"
#include "BoundingBox.hpp"
#include <boost/multiprecision/integer.hpp>

View File

@ -520,6 +520,8 @@ const std::vector<GCodeViewer::Color> GCodeViewer::Travel_Colors {{
{ 0.505f, 0.064f, 0.028f, 1.0f } // Retract
}};
#if 1
// Normal ranges
const std::vector<GCodeViewer::Color> 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::Color> 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::Color> 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 };

View File

@ -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<Vec3d> 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<float>(build_volume.circle().center.x()), unscaled<float>(build_volume.circle().center.y()), unscaled<float>(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<int>(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<Vec3d> 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<float>(build_volume.circle().center.x()), unscaled<float>(build_volume.circle().center.y()), unscaled<float>(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<int>(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;
}
}

View File

@ -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());