Merge branch 'master' into fs_svg_SPE-1517

This commit is contained in:
Filip Sykala - NTB T15p 2023-10-03 15:12:52 +02:00
commit 4ecc22638b
10 changed files with 159 additions and 93 deletions

View File

@ -1,4 +1,5 @@
min_slic3r_version = 2.6.0-beta1
0.2.8 Fixed compatible printer condition.
0.2.7 Fixed compatible condition for MONO X.
0.2.6 Added MONO X 6K.
0.2.5 Fixed output file format for MONO SE.

View File

@ -5,7 +5,7 @@
name = Anycubic
# Configuration version of this file. Config file will only be installed, if the config_version differs.
# This means, the server may force the PrusaSlicer configuration to be downgraded.
config_version = 0.2.7
config_version = 0.2.8
# Where to get the updates from?
config_update_url = https://files.prusa3d.com/wp-content/uploads/repository/PrusaSlicer-settings-master/live/Anycubic/
# changelog_url = https://files.prusa3d.com/?latest=slicer-profiles&lng=%1%
@ -2452,7 +2452,7 @@ initial_exposure_time = 30
material_type = Plant-Based
material_vendor = Anycubic
material_colour = #808080
compatible_printers_condition = printer_model=="PHOTON MONO SE" and
compatible_printers_condition = printer_model=="PHOTON MONO SE"
material_notes = LIFT_SPEED=2
## Printers

View File

@ -1,4 +1,5 @@
min_slic3r_version = 2.6.2-alpha0
1.11.0-alpha6 Increased MBL temperature for PET. Enabled FW-specific object labels for XL/MK3.9/MK4/MINI. PETG V0 marked as UL certified for MK4.
1.11.0-alpha5 Added new profiles (additional nozzle diameters) for Prusa MINI Input Shaper (Alpha). Arc fitting changed to I J.
1.11.0-alpha4 Updated compatible printer conditions for specific filament profiles.
1.11.0-alpha3 Added new print profiles for Prusa MINI Input Shaper (Alpha). Updated MK4 IS profiles.

File diff suppressed because one or more lines are too long

View File

@ -97,7 +97,8 @@ inline IType Round(double val)
{
double v = FRound(val);
#if defined(CLIPPERLIB_INT32) && ! defined(NDEBUG)
static constexpr const double hi = 65536 * 16383;
static_assert(sizeof(IType) == 4 || sizeof(IType) == 8, "IType must be int32 or int64");
static constexpr const double hi = 65536. * 16383. * (sizeof(IType) == 4 ? 1 : 65536. * 65536.);
if (v > hi || -v > hi)
throw clipperException("Coordinate outside allowed range");
#endif

View File

@ -2,8 +2,7 @@
///|/ Copyright (c) SuperSlicer 2023 Remi Durand @supermerill
///|/
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
///|/
#include "libslic3r/libslic3r.h"
///|/#include "libslic3r/libslic3r.h"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Print.hpp"
#include "libslic3r/LocalesUtils.hpp"
@ -2888,7 +2887,17 @@ void GCodeProcessor::process_G1(const std::array<std::optional<double>, 4>& axes
void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool clockwise)
{
enum class EFitting { None, IJ, R };
const EFitting fitting = line.has('R') ? EFitting::R : (line.has('I') && line.has('J')) ? EFitting::IJ : EFitting::None;
std::string_view axis_pos_I;
std::string_view axis_pos_J;
EFitting fitting = EFitting::None;
if (line.has('R')) {
fitting = EFitting::R;
} else {
axis_pos_I = line.axis_pos('I');
axis_pos_J = line.axis_pos('J');
if (! axis_pos_I.empty() || ! axis_pos_J.empty())
fitting = EFitting::IJ;
}
if (fitting == EFitting::None)
return;
@ -2921,7 +2930,10 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line, bool cloc
rel_center.y() = c.y() - m_start_position[Y];
}
else {
if (!line.has_value('I', rel_center.x()) || !line.has_value('J', rel_center.y()))
assert(fitting == EFitting::IJ);
if (! axis_pos_I.empty() && ! line.has_value(axis_pos_I, rel_center.x()))
return;
if (! axis_pos_J.empty() && ! line.has_value(axis_pos_J, rel_center.y()))
return;
}

View File

@ -237,33 +237,41 @@ const char* GCodeReader::axis_pos(const char *raw_str, char axis)
bool GCodeReader::GCodeLine::has(char axis) const
{
const char *c = axis_pos(m_raw.c_str(), axis);
return c != nullptr;
return GCodeReader::axis_pos(this->raw().c_str(), axis);
}
bool GCodeReader::GCodeLine::has_value(char axis, float &value) const
std::string_view GCodeReader::GCodeLine::axis_pos(char axis) const
{
assert(is_decimal_separator_point());
const char *c = axis_pos(m_raw.c_str(), axis);
if (c == nullptr)
return false;
const std::string &s = this->raw();
const char *c = GCodeReader::axis_pos(this->raw().c_str(), axis);
return c ? std::string_view{ c, s.size() - (c - s.data()) } : std::string_view();
}
bool GCodeReader::GCodeLine::has_value(std::string_view axis_pos, float &value)
{
if (const char *c = axis_pos.data(); c) {
// Try to parse the numeric value.
double v = 0.;
const char* end = m_raw.c_str() + m_raw.size();
const char *end = axis_pos.data() + axis_pos.size();
auto [pend, ec] = fast_float::from_chars(++ c, end, v);
if (pend != c && is_end_of_word(*pend)) {
// The axis value has been parsed correctly.
value = float(v);
return true;
}
}
return false;
}
bool GCodeReader::GCodeLine::has_value(char axis, int &value) const
bool GCodeReader::GCodeLine::has_value(char axis, float &value) const
{
const char *c = axis_pos(m_raw.c_str(), axis);
if (c == nullptr)
return false;
assert(is_decimal_separator_point());
return this->has_value(this->axis_pos(axis), value);
}
bool GCodeReader::GCodeLine::has_value(std::string_view axis_pos, int &value)
{
if (const char *c = axis_pos.data(); c) {
// Try to parse the numeric value.
char *pend = nullptr;
long v = strtol(++ c, &pend, 10);
@ -272,9 +280,15 @@ bool GCodeReader::GCodeLine::has_value(char axis, int &value) const
value = int(v);
return true;
}
}
return false;
}
bool GCodeReader::GCodeLine::has_value(char axis, int &value) const
{
return this->has_value(this->axis_pos(axis), value);
}
void GCodeReader::GCodeLine::set(const GCodeReader &reader, const Axis axis, const float new_value, const int decimal_digits)
{
std::ostringstream ss;

View File

@ -30,11 +30,16 @@ public:
const std::string_view comment() const
{ size_t pos = m_raw.find(';'); return (pos == std::string::npos) ? std::string_view() : std::string_view(m_raw).substr(pos + 1); }
// Return position in this->raw() string starting with the "axis" character.
std::string_view axis_pos(char axis) const;
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
float value(Axis axis) const { return m_axis[axis]; }
bool has(char axis) const;
bool has_value(char axis, float &value) const;
bool has_value(char axis, int &value) const;
// Parse value of an axis from raw string starting at axis_pos.
static bool has_value(std::string_view axis_pos, float &value);
static bool has_value(std::string_view axis_pos, int &value);
float new_X(const GCodeReader &reader) const { return this->has(X) ? this->x() : reader.x(); }
float new_Y(const GCodeReader &reader) const { return this->has(Y) ? this->y() : reader.y(); }
float new_Z(const GCodeReader &reader) const { return this->has(Z) ? this->z() : reader.z(); }

View File

@ -264,8 +264,11 @@ static std::optional<Circle> try_create_circle(const Points::const_iterator begi
// of all points on the polyline to be fitted.
Vec2i64 first_point = begin->cast<int64_t>();
Vec2i64 last_point = std::prev(end)->cast<int64_t>();
Vec2i64 c = (first_point.cast<int64_t>() + last_point.cast<int64_t>()) / 2;
Vec2i64 v = last_point - first_point;
Vec2d vd = v.cast<double>();
double ld = v.squaredNorm();
if (ld > sqr(scaled<double>(0.0015))) {
Vec2i64 c = (first_point.cast<int64_t>() + last_point.cast<int64_t>()) / 2;
Vec2i64 prev_point = first_point;
int prev_side = sign(v.dot(prev_point - c));
assert(prev_side != 0);
@ -280,8 +283,7 @@ static std::optional<Circle> try_create_circle(const Points::const_iterator begi
int sideness = this_side * prev_side;
if (sideness < 0) {
// Calculate the intersection point.
Vec2d vd = v.cast<double>();
Vec2d p = c.cast<double>() + vd * double(d) / vd.squaredNorm();
Vec2d p = c.cast<double>() + vd * double(d) / ld;
point_on_bisector = p.cast<coord_t>();
break;
}
@ -303,6 +305,7 @@ static std::optional<Circle> try_create_circle(const Points::const_iterator begi
circle && ! circle_approximation_sufficient(*circle, begin, end, tolerance * 2))
circle.reset();
}
}
if (circle) {
// Fit the arc between the end points by least squares.
// Optimize over all points along the path and the centers of the segments.
@ -320,8 +323,10 @@ static std::optional<Circle> try_create_circle(const Points::const_iterator begi
std::optional<Vec2d> opt_center = ArcWelder::arc_fit_center_gauss_newton_ls(first_point, last_point,
circle->center.cast<double>(), fpts.begin(), fpts.end(), 5);
if (opt_center) {
// Fitted radius must not be excessively large. If so, it is better to fit with a line segment.
if (const double r2 = (*opt_center - first_point).squaredNorm(); r2 < max_radius * max_radius) {
circle->center = opt_center->cast<coord_t>();
circle->radius = (circle->radius > 0 ? 1.f : -1.f) * (*opt_center - first_point).norm();
circle->radius = (circle->radius > 0 ? 1.f : -1.f) * sqrt(r2);
if (circle_approximation_sufficient(*circle, begin, end, tolerance)) {
out = circle;
} else {
@ -330,6 +335,7 @@ static std::optional<Circle> try_create_circle(const Points::const_iterator begi
}
}
}
}
/*
// From the original arc welder.
// Such a loop makes the time complexity of the arc fitting an ugly O(n^3).

View File

@ -657,10 +657,11 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
auto printer_technology = printers.get_selected_preset().printer_technology();
if (printer_technology == ptFFF && ! preferred_selection.filament.empty()) {
const std::string& preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_FILAMENT, preferred_selection.filament, 0);
if (auto it = filaments.find_preset_internal(preferred_preset_name);
it != filaments.end() && it->is_visible && it->is_compatible) {
ExtruderFilaments& extruder_frst = this->extruders_filaments.front();
if (auto it = extruder_frst.find_filament_internal(preferred_preset_name);
it != extruder_frst.end() && it->preset->is_visible && it->is_compatible) {
if (extruder_frst.select_filament(preferred_preset_name))
filaments.select_preset_by_name_strict(preferred_preset_name);
this->extruders_filaments.front().select_filament(filaments.get_selected_preset_name());
}
} else if (printer_technology == ptSLA && ! preferred_selection.sla_material.empty()) {
const std::string& preferred_preset_name = get_preset_name_by_alias(Preset::Type::TYPE_SLA_MATERIAL, preferred_selection.sla_material);