mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 10:35:52 +08:00
Removed G2/3 R option, it does not work correctly
This commit is contained in:
parent
e6c4522143
commit
30861c81d2
@ -3071,7 +3071,6 @@ std::string GCodeGenerator::_extrude(
|
||||
Vec2d prev = GCodeFormatter::quantize(prev_exact);
|
||||
auto it = path.begin();
|
||||
auto end = path.end();
|
||||
const bool emit_radius = m_config.arc_fitting == ArcFittingType::EmitRadius;
|
||||
for (++ it; it != end; ++ it) {
|
||||
Vec2d p_exact = this->point_to_gcode(it->point);
|
||||
Vec2d p = GCodeFormatter::quantize(p_exact);
|
||||
@ -3082,14 +3081,9 @@ std::string GCodeGenerator::_extrude(
|
||||
Vec2d ij;
|
||||
if (it->radius != 0) {
|
||||
// Extrude an arc.
|
||||
assert(m_config.arc_fitting == ArcFittingType::EmitCenter ||
|
||||
m_config.arc_fitting == ArcFittingType::EmitRadius);
|
||||
assert(m_config.arc_fitting == ArcFittingType::EmitCenter);
|
||||
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.
|
||||
ij = GCodeFormatter::quantize(Vec2d(
|
||||
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;
|
||||
const double dE = e_per_mm * line_length;
|
||||
assert(dE > 0);
|
||||
gcode += emit_radius ?
|
||||
m_writer.extrude_to_xy_G2G3R(p, radius, it->ccw(), dE, comment) :
|
||||
m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment);
|
||||
gcode += m_writer.extrude_to_xy_G2G3IJ(p, ij, it->ccw(), dE, comment);
|
||||
}
|
||||
prev = p;
|
||||
prev_exact = p_exact;
|
||||
|
@ -302,22 +302,6 @@ std::string GCodeWriter::travel_to_xy_G2G3IJ(const Vec2d &point, const Vec2d &ij
|
||||
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)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
|
||||
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
|
||||
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 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_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_z(double z, const std::string_view comment = {});
|
||||
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_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 retract(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);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
if (! axis.empty()) {
|
||||
// not gcfNoExtrusion
|
||||
|
@ -116,16 +116,15 @@ std::string Wipe::wipe(GCodeGenerator &gcodegen, bool toolchange)
|
||||
retract_length -= dE;
|
||||
return done;
|
||||
};
|
||||
const bool emit_radius = gcodegen.config().arc_fitting == ArcFittingType::EmitRadius;
|
||||
auto wipe_arc = [&gcode, &gcodegen, &retract_length, xy_to_e, emit_radius, &wipe_linear](
|
||||
auto wipe_arc = [&gcode, &gcodegen, &retract_length, xy_to_e, &wipe_linear](
|
||||
const Vec2d &prev_quantized, Vec2d &p, double radius_in, const bool ccw) {
|
||||
Vec2d p_quantized = GCodeFormatter::quantize(p);
|
||||
if (p_quantized == prev_quantized) {
|
||||
p = p_quantized;
|
||||
return false;
|
||||
}
|
||||
// Only quantize radius if emitting it directly into G-code. Otherwise use the exact radius for calculating the IJ values.
|
||||
double radius = emit_radius ? GCodeFormatter::quantize_xyzf(radius_in) : radius_in;
|
||||
// Use the exact radius for calculating the IJ values, no quantization.
|
||||
double radius = radius_in;
|
||||
if (radius == 0)
|
||||
// Degenerated arc after quantization. Process it as if it was a line segment.
|
||||
return wipe_linear(prev_quantized, p);
|
||||
@ -151,9 +150,7 @@ std::string Wipe::wipe(GCodeGenerator &gcodegen, bool toolchange)
|
||||
} else
|
||||
p = p_quantized;
|
||||
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.
|
||||
Vec2d ij = GCodeFormatter::quantize(Vec2d(center - prev_quantized));
|
||||
if (ij == Vec2d::Zero())
|
||||
|
@ -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 {
|
||||
{ "disabled", int(ArcFittingType::Disabled) },
|
||||
{ "emit_center", int(ArcFittingType::EmitCenter) },
|
||||
{ "emit_radius", int(ArcFittingType::EmitRadius) }
|
||||
{ "emit_center", int(ArcFittingType::EmitCenter) }
|
||||
};
|
||||
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ArcFittingType)
|
||||
|
||||
@ -441,8 +440,7 @@ void PrintConfigDef::init_fff_params()
|
||||
"G-code resolution will be used as the fitting tolerance.");
|
||||
def->set_enum<ArcFittingType>({
|
||||
{ "disabled", "Disabled" },
|
||||
{ "emit_center", "Enabled: G2/3 I J" },
|
||||
{ "emit_radius", "Enabled: G2/3 R" }
|
||||
{ "emit_center", "Enabled: G2/3 I J" }
|
||||
});
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionEnum<ArcFittingType>(ArcFittingType::Disabled));
|
||||
|
@ -49,8 +49,7 @@ namespace Slic3r {
|
||||
|
||||
enum class ArcFittingType {
|
||||
Disabled,
|
||||
EmitCenter,
|
||||
EmitRadius,
|
||||
EmitCenter
|
||||
};
|
||||
|
||||
enum GCodeFlavor : unsigned char {
|
||||
|
Loading…
x
Reference in New Issue
Block a user