mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-12 12:49:10 +08:00
Merge branch 'master' into fs_svg_SPE-1517
This commit is contained in:
commit
4088a4bcd6
@ -11,9 +11,24 @@
|
|||||||
#include "objparser.hpp"
|
#include "objparser.hpp"
|
||||||
|
|
||||||
#include "libslic3r/LocalesUtils.hpp"
|
#include "libslic3r/LocalesUtils.hpp"
|
||||||
|
#include "fast_float/fast_float.h"
|
||||||
|
|
||||||
namespace ObjParser {
|
namespace ObjParser {
|
||||||
|
|
||||||
|
// To fix issues with obj loading on macOS Sonoma, we use the following function instead of strtod that
|
||||||
|
// was used before. Apparently the locales are not handled as they should. We already saw this before in
|
||||||
|
// https://github.com/prusa3d/PrusaSlicer/issues/10380.
|
||||||
|
static double strtod_clocale(const char* str, char const** str_end)
|
||||||
|
{
|
||||||
|
double val = 0.;
|
||||||
|
auto [pend, ec] = fast_float::from_chars(str, *str_end, val);
|
||||||
|
if (pend != str && ec != std::errc::result_out_of_range)
|
||||||
|
*str_end = pend; // success
|
||||||
|
else
|
||||||
|
*str_end = str;
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
static bool obj_parseline(const char *line, ObjData &data)
|
static bool obj_parseline(const char *line, ObjData &data)
|
||||||
{
|
{
|
||||||
#define EATWS() while (*line == ' ' || *line == '\t') ++ line
|
#define EATWS() while (*line == ' ' || *line == '\t') ++ line
|
||||||
@ -45,15 +60,15 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
if (c2 != ' ' && c2 != '\t')
|
if (c2 != ' ' && c2 != '\t')
|
||||||
return false;
|
return false;
|
||||||
EATWS();
|
EATWS();
|
||||||
char *endptr = 0;
|
const char *endptr = 0;
|
||||||
double u = strtod(line, &endptr);
|
double u = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double v = 0;
|
double v = 0;
|
||||||
if (*line != 0) {
|
if (*line != 0) {
|
||||||
v = strtod(line, &endptr);
|
v = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
@ -61,7 +76,7 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
}
|
}
|
||||||
double w = 0;
|
double w = 0;
|
||||||
if (*line != 0) {
|
if (*line != 0) {
|
||||||
w = strtod(line, &endptr);
|
w = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
@ -82,18 +97,18 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
if (c2 != ' ' && c2 != '\t')
|
if (c2 != ' ' && c2 != '\t')
|
||||||
return false;
|
return false;
|
||||||
EATWS();
|
EATWS();
|
||||||
char *endptr = 0;
|
const char *endptr = 0;
|
||||||
double x = strtod(line, &endptr);
|
double x = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double y = strtod(line, &endptr);
|
double y = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double z = strtod(line, &endptr);
|
double z = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
@ -112,20 +127,20 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
if (c2 != ' ' && c2 != '\t')
|
if (c2 != ' ' && c2 != '\t')
|
||||||
return false;
|
return false;
|
||||||
EATWS();
|
EATWS();
|
||||||
char *endptr = 0;
|
const char *endptr = 0;
|
||||||
double u = strtod(line, &endptr);
|
double u = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double v = strtod(line, &endptr);
|
double v = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double w = 0;
|
double w = 0;
|
||||||
if (*line != 0) {
|
if (*line != 0) {
|
||||||
w = strtod(line, &endptr);
|
w = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
@ -144,25 +159,25 @@ static bool obj_parseline(const char *line, ObjData &data)
|
|||||||
if (c2 != ' ' && c2 != '\t')
|
if (c2 != ' ' && c2 != '\t')
|
||||||
return false;
|
return false;
|
||||||
EATWS();
|
EATWS();
|
||||||
char *endptr = 0;
|
const char *endptr = 0;
|
||||||
double x = strtod(line, &endptr);
|
double x = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double y = strtod(line, &endptr);
|
double y = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t'))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double z = strtod(line, &endptr);
|
double z = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
EATWS();
|
EATWS();
|
||||||
double w = 1.0;
|
double w = 1.0;
|
||||||
if (*line != 0) {
|
if (*line != 0) {
|
||||||
w = strtod(line, &endptr);
|
w = strtod_clocale(line, &endptr);
|
||||||
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
if (endptr == 0 || (*endptr != ' ' && *endptr != '\t' && *endptr != 0))
|
||||||
return false;
|
return false;
|
||||||
line = endptr;
|
line = endptr;
|
||||||
|
@ -3071,7 +3071,6 @@ std::string GCodeGenerator::_extrude(
|
|||||||
Vec2d prev = GCodeFormatter::quantize(prev_exact);
|
Vec2d prev = GCodeFormatter::quantize(prev_exact);
|
||||||
auto it = path.begin();
|
auto it = path.begin();
|
||||||
auto end = path.end();
|
auto end = path.end();
|
||||||
const bool emit_radius = m_config.arc_fitting == ArcFittingType::EmitRadius;
|
|
||||||
for (++ it; it != end; ++ it) {
|
for (++ it; it != end; ++ it) {
|
||||||
Vec2d p_exact = this->point_to_gcode(it->point);
|
Vec2d p_exact = this->point_to_gcode(it->point);
|
||||||
Vec2d p = GCodeFormatter::quantize(p_exact);
|
Vec2d p = GCodeFormatter::quantize(p_exact);
|
||||||
@ -3082,14 +3081,9 @@ std::string GCodeGenerator::_extrude(
|
|||||||
Vec2d ij;
|
Vec2d ij;
|
||||||
if (it->radius != 0) {
|
if (it->radius != 0) {
|
||||||
// Extrude an arc.
|
// Extrude an arc.
|
||||||
assert(m_config.arc_fitting == ArcFittingType::EmitCenter ||
|
assert(m_config.arc_fitting == ArcFittingType::EmitCenter);
|
||||||
m_config.arc_fitting == ArcFittingType::EmitRadius);
|
|
||||||
radius = unscaled<double>(it->radius);
|
radius = unscaled<double>(it->radius);
|
||||||
if (emit_radius) {
|
{
|
||||||
// Only quantize radius if emitting it directly into G-code. Otherwise use the exact radius for calculating the IJ values.
|
|
||||||
//FIXME rather re-fit the arc to improve accuracy!
|
|
||||||
radius = GCodeFormatter::quantize_xyzf(radius);
|
|
||||||
} else {
|
|
||||||
// Calculate quantized IJ circle center offset.
|
// Calculate quantized IJ circle center offset.
|
||||||
ij = GCodeFormatter::quantize(Vec2d(
|
ij = GCodeFormatter::quantize(Vec2d(
|
||||||
Geometry::ArcWelder::arc_center(prev_exact.cast<double>(), p_exact.cast<double>(), double(radius), it->ccw())
|
Geometry::ArcWelder::arc_center(prev_exact.cast<double>(), p_exact.cast<double>(), double(radius), it->ccw())
|
||||||
@ -3112,9 +3106,7 @@ std::string GCodeGenerator::_extrude(
|
|||||||
path_length += line_length;
|
path_length += line_length;
|
||||||
const double dE = e_per_mm * line_length;
|
const double dE = e_per_mm * line_length;
|
||||||
assert(dE > 0);
|
assert(dE > 0);
|
||||||
gcode += emit_radius ?
|
gcode += m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment);
|
||||||
m_writer.extrude_to_xy_G2G3R(p, radius, it->ccw(), dE, comment) :
|
|
||||||
m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment);
|
|
||||||
}
|
}
|
||||||
prev = p;
|
prev = p;
|
||||||
prev_exact = p_exact;
|
prev_exact = p_exact;
|
||||||
|
@ -302,22 +302,6 @@ std::string GCodeWriter::travel_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij
|
|||||||
return w.string();
|
return w.string();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GCodeWriter::travel_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, const std::string_view comment)
|
|
||||||
{
|
|
||||||
assert(std::abs(point.x()) < 1200.);
|
|
||||||
assert(std::abs(point.y()) < 1200.);
|
|
||||||
assert(std::abs(radius) >= 0.001);
|
|
||||||
assert(std::abs(radius) < 1800.);
|
|
||||||
|
|
||||||
m_pos.head<2>() = point.head<2>();
|
|
||||||
|
|
||||||
GCodeG2G3Formatter w(ccw);
|
|
||||||
w.emit_xy(point);
|
|
||||||
w.emit_radius(radius);
|
|
||||||
w.emit_comment(this->config.gcode_comments, comment);
|
|
||||||
return w.string();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string_view comment)
|
std::string GCodeWriter::travel_to_xyz(const Vec3d &point, const std::string_view comment)
|
||||||
{
|
{
|
||||||
// FIXME: This function was not being used when travel_speed_z was separated (bd6badf).
|
// FIXME: This function was not being used when travel_speed_z was separated (bd6badf).
|
||||||
@ -431,25 +415,6 @@ std::string GCodeWriter::extrude_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &i
|
|||||||
return w.string();
|
return w.string();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GCodeWriter::extrude_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, double dE, const std::string_view comment)
|
|
||||||
{
|
|
||||||
assert(dE != 0);
|
|
||||||
assert(std::abs(dE) < 1000.0);
|
|
||||||
assert(std::abs(point.x()) < 1200.);
|
|
||||||
assert(std::abs(point.y()) < 1200.);
|
|
||||||
assert(std::abs(radius) >= 0.001);
|
|
||||||
assert(std::abs(radius) < 1800.);
|
|
||||||
|
|
||||||
m_pos.head<2>() = point.head<2>();
|
|
||||||
|
|
||||||
GCodeG2G3Formatter w(ccw);
|
|
||||||
w.emit_xy(point);
|
|
||||||
w.emit_radius(radius);
|
|
||||||
w.emit_e(m_extrusion_axis, m_extruder->extrude(dE).second);
|
|
||||||
w.emit_comment(this->config.gcode_comments, comment);
|
|
||||||
return w.string();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std::string_view comment)
|
std::string GCodeWriter::extrude_to_xyz(const Vec3d &point, double dE, const std::string_view comment)
|
||||||
{
|
{
|
||||||
|
@ -69,13 +69,11 @@ public:
|
|||||||
std::string set_speed(double F, const std::string_view comment = {}, const std::string_view cooling_marker = {}) const;
|
std::string set_speed(double F, const std::string_view comment = {}, const std::string_view cooling_marker = {}) const;
|
||||||
std::string travel_to_xy(const Vec2d &point, const std::string_view comment = {});
|
std::string travel_to_xy(const Vec2d &point, const std::string_view comment = {});
|
||||||
std::string travel_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij, const bool ccw, const std::string_view comment = {});
|
std::string travel_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij, const bool ccw, const std::string_view comment = {});
|
||||||
std::string travel_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, const std::string_view comment = {});
|
|
||||||
std::string travel_to_xyz(const Vec3d &point, const std::string_view comment = {});
|
std::string travel_to_xyz(const Vec3d &point, const std::string_view comment = {});
|
||||||
std::string travel_to_z(double z, const std::string_view comment = {});
|
std::string travel_to_z(double z, const std::string_view comment = {});
|
||||||
bool will_move_z(double z) const;
|
bool will_move_z(double z) const;
|
||||||
std::string extrude_to_xy(const Vec2d &point, double dE, const std::string_view comment = {});
|
std::string extrude_to_xy(const Vec2d &point, double dE, const std::string_view comment = {});
|
||||||
std::string extrude_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij, const bool ccw, double dE, const std::string_view comment);
|
std::string extrude_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij, const bool ccw, double dE, const std::string_view comment);
|
||||||
std::string extrude_to_xy_G2G3R(const Vec2d &point, const double radius, const bool ccw, double dE, const std::string_view comment);
|
|
||||||
// std::string extrude_to_xyz(const Vec3d &point, double dE, const std::string_view comment = {});
|
// std::string extrude_to_xyz(const Vec3d &point, double dE, const std::string_view comment = {});
|
||||||
std::string retract(bool before_wipe = false);
|
std::string retract(bool before_wipe = false);
|
||||||
std::string retract_for_toolchange(bool before_wipe = false);
|
std::string retract_for_toolchange(bool before_wipe = false);
|
||||||
@ -195,12 +193,6 @@ public:
|
|||||||
this->emit_axis('J', point.y(), XYZF_EXPORT_DIGITS);
|
this->emit_axis('J', point.y(), XYZF_EXPORT_DIGITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positive radius means a smaller arc,
|
|
||||||
// negative radius means a larger arc.
|
|
||||||
void emit_radius(const double radius) {
|
|
||||||
this->emit_axis('R', radius, XYZF_EXPORT_DIGITS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void emit_e(const std::string_view axis, double v) {
|
void emit_e(const std::string_view axis, double v) {
|
||||||
if (! axis.empty()) {
|
if (! axis.empty()) {
|
||||||
// not gcfNoExtrusion
|
// not gcfNoExtrusion
|
||||||
|
@ -116,16 +116,15 @@ std::string Wipe::wipe(GCodeGenerator &gcodegen, bool toolchange)
|
|||||||
retract_length -= dE;
|
retract_length -= dE;
|
||||||
return done;
|
return done;
|
||||||
};
|
};
|
||||||
const bool emit_radius = gcodegen.config().arc_fitting == ArcFittingType::EmitRadius;
|
auto wipe_arc = [&gcode, &gcodegen, &retract_length, xy_to_e, &wipe_linear](
|
||||||
auto wipe_arc = [&gcode, &gcodegen, &retract_length, xy_to_e, emit_radius, &wipe_linear](
|
|
||||||
const Vec2d &prev_quantized, Vec2d &p, double radius_in, const bool ccw) {
|
const Vec2d &prev_quantized, Vec2d &p, double radius_in, const bool ccw) {
|
||||||
Vec2d p_quantized = GCodeFormatter::quantize(p);
|
Vec2d p_quantized = GCodeFormatter::quantize(p);
|
||||||
if (p_quantized == prev_quantized) {
|
if (p_quantized == prev_quantized) {
|
||||||
p = p_quantized;
|
p = p_quantized;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Only quantize radius if emitting it directly into G-code. Otherwise use the exact radius for calculating the IJ values.
|
// Use the exact radius for calculating the IJ values, no quantization.
|
||||||
double radius = emit_radius ? GCodeFormatter::quantize_xyzf(radius_in) : radius_in;
|
double radius = radius_in;
|
||||||
if (radius == 0)
|
if (radius == 0)
|
||||||
// Degenerated arc after quantization. Process it as if it was a line segment.
|
// Degenerated arc after quantization. Process it as if it was a line segment.
|
||||||
return wipe_linear(prev_quantized, p);
|
return wipe_linear(prev_quantized, p);
|
||||||
@ -151,9 +150,7 @@ std::string Wipe::wipe(GCodeGenerator &gcodegen, bool toolchange)
|
|||||||
} else
|
} else
|
||||||
p = p_quantized;
|
p = p_quantized;
|
||||||
assert(dE > 0);
|
assert(dE > 0);
|
||||||
if (emit_radius) {
|
{
|
||||||
gcode += gcodegen.writer().extrude_to_xy_G2G3R(p, radius, ccw, -dE, wipe_retract_comment);
|
|
||||||
} else {
|
|
||||||
// Calculate quantized IJ circle center offset.
|
// Calculate quantized IJ circle center offset.
|
||||||
Vec2d ij = GCodeFormatter::quantize(Vec2d(center - prev_quantized));
|
Vec2d ij = GCodeFormatter::quantize(Vec2d(center - prev_quantized));
|
||||||
if (ij == Vec2d::Zero())
|
if (ij == Vec2d::Zero())
|
||||||
|
@ -375,6 +375,7 @@ double arc_fit_max_deviation(const Point &start_point, const Point &end_point, c
|
|||||||
const Points::const_iterator begin, const Points::const_iterator end);
|
const Points::const_iterator begin, const Points::const_iterator end);
|
||||||
|
|
||||||
// 1.2m diameter, maximum given by coord_t
|
// 1.2m diameter, maximum given by coord_t
|
||||||
|
static_assert(sizeof(coord_t) == 4);
|
||||||
static constexpr const double default_scaled_max_radius = scaled<double>(600.);
|
static constexpr const double default_scaled_max_radius = scaled<double>(600.);
|
||||||
// 0.05mm
|
// 0.05mm
|
||||||
static constexpr const double default_scaled_resolution = scaled<double>(0.05);
|
static constexpr const double default_scaled_resolution = scaled<double>(0.05);
|
||||||
|
@ -465,7 +465,7 @@ static std::vector<std::string> s_Preset_print_options {
|
|||||||
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
|
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
|
||||||
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
|
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
|
||||||
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "infill_anchor", "infill_anchor_max", "bridge_flow_ratio",
|
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "infill_anchor", "infill_anchor_max", "bridge_flow_ratio",
|
||||||
"elefant_foot_compensation", "xy_size_compensation", "resolution", "gcode_resolution", "arc_fitting", "arc_fitting_tolerance",
|
"elefant_foot_compensation", "xy_size_compensation", "resolution", "gcode_resolution", "arc_fitting",
|
||||||
"wipe_tower", "wipe_tower_x", "wipe_tower_y",
|
"wipe_tower", "wipe_tower_x", "wipe_tower_y",
|
||||||
"wipe_tower_width", "wipe_tower_cone_angle", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_bridging", "single_extruder_multi_material_priming", "mmu_segmented_region_max_width",
|
"wipe_tower_width", "wipe_tower_cone_angle", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_bridging", "single_extruder_multi_material_priming", "mmu_segmented_region_max_width",
|
||||||
"mmu_segmented_region_interlocking_depth", "wipe_tower_extruder", "wipe_tower_no_sparse_layers", "wipe_tower_extra_spacing", "compatible_printers", "compatible_printers_condition", "inherits",
|
"mmu_segmented_region_interlocking_depth", "wipe_tower_extruder", "wipe_tower_no_sparse_layers", "wipe_tower_extra_spacing", "compatible_printers", "compatible_printers_condition", "inherits",
|
||||||
|
@ -59,8 +59,7 @@ static t_config_enum_names enum_names_from_keys_map(const t_config_enum_values &
|
|||||||
|
|
||||||
static const t_config_enum_values s_keys_map_ArcFittingType {
|
static const t_config_enum_values s_keys_map_ArcFittingType {
|
||||||
{ "disabled", int(ArcFittingType::Disabled) },
|
{ "disabled", int(ArcFittingType::Disabled) },
|
||||||
{ "emit_center", int(ArcFittingType::EmitCenter) },
|
{ "emit_center", int(ArcFittingType::EmitCenter) }
|
||||||
{ "emit_radius", int(ArcFittingType::EmitRadius) }
|
|
||||||
};
|
};
|
||||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ArcFittingType)
|
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ArcFittingType)
|
||||||
|
|
||||||
@ -441,21 +440,11 @@ void PrintConfigDef::init_fff_params()
|
|||||||
"G-code resolution will be used as the fitting tolerance.");
|
"G-code resolution will be used as the fitting tolerance.");
|
||||||
def->set_enum<ArcFittingType>({
|
def->set_enum<ArcFittingType>({
|
||||||
{ "disabled", "Disabled" },
|
{ "disabled", "Disabled" },
|
||||||
{ "emit_center", "Enabled: G2/3 I J" },
|
{ "emit_center", "Enabled: G2/3 I J" }
|
||||||
{ "emit_radius", "Enabled: G2/3 R" }
|
|
||||||
});
|
});
|
||||||
def->mode = comAdvanced;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionEnum<ArcFittingType>(ArcFittingType::Disabled));
|
def->set_default_value(new ConfigOptionEnum<ArcFittingType>(ArcFittingType::Disabled));
|
||||||
|
|
||||||
def = this->add("arc_fitting_tolerance", coFloatOrPercent);
|
|
||||||
def->label = L("Arc fitting tolerance");
|
|
||||||
def->sidetext = L("mm or %");
|
|
||||||
def->tooltip = L("When using the arc_fitting option, allow the curve to deviate certain % from the collection of straight paths.\n"
|
|
||||||
"Can be either a mm value or a percentage of the current extrusion width.");
|
|
||||||
def->mode = comAdvanced;
|
|
||||||
def->min = 0;
|
|
||||||
def->set_default_value(new ConfigOptionFloatOrPercent(5, true));
|
|
||||||
|
|
||||||
// Maximum extruder temperature, bumped to 1500 to support printing of glass.
|
// Maximum extruder temperature, bumped to 1500 to support printing of glass.
|
||||||
const int max_temp = 1500;
|
const int max_temp = 1500;
|
||||||
def = this->add("avoid_crossing_curled_overhangs", coBool);
|
def = this->add("avoid_crossing_curled_overhangs", coBool);
|
||||||
|
@ -49,8 +49,7 @@ namespace Slic3r {
|
|||||||
|
|
||||||
enum class ArcFittingType {
|
enum class ArcFittingType {
|
||||||
Disabled,
|
Disabled,
|
||||||
EmitCenter,
|
EmitCenter
|
||||||
EmitRadius,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GCodeFlavor : unsigned char {
|
enum GCodeFlavor : unsigned char {
|
||||||
@ -701,7 +700,6 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||||||
GCodeConfig,
|
GCodeConfig,
|
||||||
|
|
||||||
((ConfigOptionEnum<ArcFittingType>, arc_fitting))
|
((ConfigOptionEnum<ArcFittingType>, arc_fitting))
|
||||||
((ConfigOptionFloatOrPercent, arc_fitting_tolerance))
|
|
||||||
((ConfigOptionBool, autoemit_temperature_commands))
|
((ConfigOptionBool, autoemit_temperature_commands))
|
||||||
((ConfigOptionString, before_layer_gcode))
|
((ConfigOptionString, before_layer_gcode))
|
||||||
((ConfigOptionString, between_objects_gcode))
|
((ConfigOptionString, between_objects_gcode))
|
||||||
|
@ -715,8 +715,7 @@ bool PrintObject::invalidate_state_by_config_options(
|
|||||||
|| opt_key == "perimeter_extrusion_width"
|
|| opt_key == "perimeter_extrusion_width"
|
||||||
|| opt_key == "infill_overlap"
|
|| opt_key == "infill_overlap"
|
||||||
|| opt_key == "external_perimeters_first"
|
|| opt_key == "external_perimeters_first"
|
||||||
|| opt_key == "arc_fitting"
|
|| opt_key == "arc_fitting") {
|
||||||
|| opt_key == "arc_fitting_tolerance") {
|
|
||||||
steps.emplace_back(posPerimeters);
|
steps.emplace_back(posPerimeters);
|
||||||
} else if (
|
} else if (
|
||||||
opt_key == "gap_fill_enabled"
|
opt_key == "gap_fill_enabled"
|
||||||
|
@ -345,9 +345,6 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config)
|
|||||||
toggle_field("min_feature_size", have_arachne);
|
toggle_field("min_feature_size", have_arachne);
|
||||||
toggle_field("min_bead_width", have_arachne);
|
toggle_field("min_bead_width", have_arachne);
|
||||||
toggle_field("thin_walls", !have_arachne);
|
toggle_field("thin_walls", !have_arachne);
|
||||||
|
|
||||||
bool has_arc_fitting = config->opt_enum<ArcFittingType>("arc_fitting") != ArcFittingType::Disabled;
|
|
||||||
toggle_field("arc_fitting_tolerance", has_arc_fitting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/)
|
void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/)
|
||||||
|
@ -2448,7 +2448,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
|||||||
// TODO: for when we're able to flash dictionaries
|
// TODO: for when we're able to flash dictionaries
|
||||||
// local_menu->Append(config_id_base + FirmwareMenuDict, _L("Flash Language File"), _L("Upload a language dictionary file into a Prusa printer"));
|
// local_menu->Append(config_id_base + FirmwareMenuDict, _L("Flash Language File"), _L("Upload a language dictionary file into a Prusa printer"));
|
||||||
}
|
}
|
||||||
local_menu->Append(config_id_base + ConfigMenuWifiConfigFile, _L("Wi-Fi Configuration File"), _L("Generate a file to be loaded by a Prusa printer to configure a Wi-Fi connection."));
|
local_menu->Append(config_id_base + ConfigMenuWifiConfigFile, _L("Wi-Fi Configuration File"), _L("Generate a file to be loaded by a Prusa printer to configure its Wi-Fi connection."));
|
||||||
|
|
||||||
local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) {
|
local_menu->Bind(wxEVT_MENU, [this, config_id_base](wxEvent &event) {
|
||||||
switch (event.GetId() - config_id_base) {
|
switch (event.GetId() - config_id_base) {
|
||||||
|
@ -1677,7 +1677,6 @@ void TabPrint::build()
|
|||||||
optgroup->append_single_option_line("resolution");
|
optgroup->append_single_option_line("resolution");
|
||||||
optgroup->append_single_option_line("gcode_resolution");
|
optgroup->append_single_option_line("gcode_resolution");
|
||||||
optgroup->append_single_option_line("arc_fitting");
|
optgroup->append_single_option_line("arc_fitting");
|
||||||
optgroup->append_single_option_line("arc_fitting_tolerance");
|
|
||||||
optgroup->append_single_option_line("xy_size_compensation");
|
optgroup->append_single_option_line("xy_size_compensation");
|
||||||
optgroup->append_single_option_line("elefant_foot_compensation", "elephant-foot-compensation_114487");
|
optgroup->append_single_option_line("elefant_foot_compensation", "elephant-foot-compensation_114487");
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace Slic3r {
|
|||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, RemovableDriveManager* removable_manager)
|
WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, RemovableDriveManager* removable_manager)
|
||||||
: DPIDialog(parent, wxID_ANY, _L("Physical Printer Instalation"), wxDefaultPosition, wxDefaultSize/*wxSize(25 * wxGetApp().em_unit(), 20 * wxGetApp().em_unit())*/, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
: DPIDialog(parent, wxID_ANY, _L("Wi-Fi Configuration File Generator"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
, m_wifi_scanner(new WifiScanner())
|
, m_wifi_scanner(new WifiScanner())
|
||||||
, out_file_path(file_path)
|
, out_file_path(file_path)
|
||||||
, m_removable_manager(removable_manager)
|
, m_removable_manager(removable_manager)
|
||||||
@ -28,6 +28,15 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
|
|||||||
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
panel->SetSizer(vsizer);
|
panel->SetSizer(vsizer);
|
||||||
|
|
||||||
|
// TRN Wifi config dialog explanation line 1.
|
||||||
|
wxStaticText* explain_label1 = new wxStaticText(panel, wxID_ANY, _L("Generate a file to be loaded by a Prusa printer to configure its Wi-Fi connection."));
|
||||||
|
// TRN Wifi config dialog explanation line 2.
|
||||||
|
wxStaticText* explain_label2 = new wxStaticText(panel, wxID_ANY, _L("Write this file on a USB flash drive. Its name will be prusa_printer_settings.ini."));
|
||||||
|
// TRN Wifi config dialog explanation line 3.
|
||||||
|
wxStaticText* explain_label3 = new wxStaticText(panel, wxID_ANY, _L("Your Prusa Printer should load this file automatically."));
|
||||||
|
// TRN Wifi config dialog explanation line 4.
|
||||||
|
wxStaticText* explain_label4 = new wxStaticText(panel, wxID_ANY, _L("Note: This file will contains SSID and password in plain text."));
|
||||||
|
|
||||||
auto* ssid_sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto* ssid_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
// TRN SSID of WiFi network.
|
// TRN SSID of WiFi network.
|
||||||
wxStaticText* ssid_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("SSID")));
|
wxStaticText* ssid_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("SSID")));
|
||||||
@ -36,6 +45,7 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
|
|||||||
m_ssid_combo->SetToolTip(_L("On some versions of MacOS, this only loads SSID of connencted network."));
|
m_ssid_combo->SetToolTip(_L("On some versions of MacOS, this only loads SSID of connencted network."));
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
rescan_networks(false);
|
rescan_networks(false);
|
||||||
|
// TRN Text of button to rescan visible networks in Wifi Config dialog.
|
||||||
wxButton* ssid_button = new wxButton(panel, wxID_ANY, _(L("Rescan")));
|
wxButton* ssid_button = new wxButton(panel, wxID_ANY, _(L("Rescan")));
|
||||||
ssid_sizer->Add(m_ssid_combo, 1, wxALIGN_CENTER_VERTICAL, 10);
|
ssid_sizer->Add(m_ssid_combo, 1, wxALIGN_CENTER_VERTICAL, 10);
|
||||||
ssid_sizer->Add(ssid_button, 0);
|
ssid_sizer->Add(ssid_button, 0);
|
||||||
@ -46,6 +56,7 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
|
|||||||
m_pass_textctrl = new wxTextCtrl(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
|
m_pass_textctrl = new wxTextCtrl(panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize);
|
||||||
pass_sizer->Add(m_pass_textctrl, 1, wxALIGN_CENTER_VERTICAL, 10);
|
pass_sizer->Add(m_pass_textctrl, 1, wxALIGN_CENTER_VERTICAL, 10);
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
|
// TRN Text of button to retrieve password from keychain in Wifi Config dialog. Only on Mac.
|
||||||
wxButton* pass_button = new wxButton(panel, wxID_ANY, _(L("Retrieve")));
|
wxButton* pass_button = new wxButton(panel, wxID_ANY, _(L("Retrieve")));
|
||||||
pass_sizer->Add(pass_button, 0);
|
pass_sizer->Add(pass_button, 0);
|
||||||
pass_button->Bind(wxEVT_BUTTON, &WifiConfigDialog::on_retrieve_password, this);
|
pass_button->Bind(wxEVT_BUTTON, &WifiConfigDialog::on_retrieve_password, this);
|
||||||
@ -58,10 +69,12 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
|
|||||||
wxStaticText* drive_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("Drive")));
|
wxStaticText* drive_label = new wxStaticText(panel, wxID_ANY, GUI::format_wxstr("%1%:", _L("Drive")));
|
||||||
m_drive_combo = new wxComboBox(panel, wxID_ANY);
|
m_drive_combo = new wxComboBox(panel, wxID_ANY);
|
||||||
rescan_drives();
|
rescan_drives();
|
||||||
|
// TRN Text of button to rescan connect usb drives in Wifi Config dialog.
|
||||||
wxButton* drive_button = new wxButton(panel, wxID_ANY, _(L("Rescan")));
|
wxButton* drive_button = new wxButton(panel, wxID_ANY, _(L("Rescan")));
|
||||||
drive_sizer->Add(m_drive_combo, 1, wxALIGN_CENTER_VERTICAL, 10);
|
drive_sizer->Add(m_drive_combo, 1, wxALIGN_CENTER_VERTICAL, 10);
|
||||||
drive_sizer->Add(drive_button, 0);
|
drive_sizer->Add(drive_button, 0);
|
||||||
|
|
||||||
|
// TRN Text of button to write config file in Wifi Config dialog.
|
||||||
wxButton* ok_button = new wxButton(panel, wxID_OK, _L("Write"));
|
wxButton* ok_button = new wxButton(panel, wxID_OK, _L("Write"));
|
||||||
wxButton* cancel_button = new wxButton(panel, wxID_CANCEL);
|
wxButton* cancel_button = new wxButton(panel, wxID_CANCEL);
|
||||||
|
|
||||||
@ -77,6 +90,10 @@ WifiConfigDialog::WifiConfigDialog(wxWindow* parent, std::string& file_path, Rem
|
|||||||
grid->Add(drive_label, 0, wxALIGN_CENTER_VERTICAL);
|
grid->Add(drive_label, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
grid->Add(drive_sizer, 0, wxEXPAND);
|
grid->Add(drive_sizer, 0, wxEXPAND);
|
||||||
|
|
||||||
|
vsizer->Add(explain_label1, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
vsizer->Add(explain_label2, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
vsizer->Add(explain_label3, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
vsizer->Add(explain_label4, 0, wxALIGN_CENTER_VERTICAL);
|
||||||
vsizer->Add(grid, 0, wxEXPAND | wxTOP | wxBOTTOM, 15);
|
vsizer->Add(grid, 0, wxEXPAND | wxTOP | wxBOTTOM, 15);
|
||||||
|
|
||||||
wxBoxSizer* buttons_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* buttons_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -144,7 +144,6 @@ void fill_wifi_map(Slic3r::WifiSsidPskMap& wifi_map, std::string& connected_ssid
|
|||||||
wxString xml(xmlstr);
|
wxString xml(xmlstr);
|
||||||
boost::property_tree::ptree pt;
|
boost::property_tree::ptree pt;
|
||||||
std::stringstream ss(boost::nowide::narrow(xml));
|
std::stringstream ss(boost::nowide::narrow(xml));
|
||||||
BOOST_LOG_TRIVIAL(error) << ss.str();
|
|
||||||
boost::property_tree::read_xml(ss, pt);
|
boost::property_tree::read_xml(ss, pt);
|
||||||
std::string password;
|
std::string password;
|
||||||
std::string psk_protected;
|
std::string psk_protected;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user