mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Fixed a regression issue to PrusaSlicer 2.1.1
Custom printer with center of bed at 0,0 results in "toolpath outside print area" #3510 The G92 A0 B0 was incorrectly considered to be equal to just G92 to reset all axes.
This commit is contained in:
parent
1cbb822dd7
commit
046f0dbfa2
4 changed files with 22 additions and 5 deletions
|
@ -444,8 +444,10 @@ void GCodeAnalyzer::_processG92(const GCodeReader::GCodeLine& line)
|
||||||
anyFound = true;
|
anyFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!anyFound)
|
if (!anyFound && ! line.has_unknown_axis())
|
||||||
{
|
{
|
||||||
|
// The G92 may be called for axes that PrusaSlicer does not recognize, for example see GH issue #3510,
|
||||||
|
// where G92 A0 B0 is called although the extruder axis is till E.
|
||||||
for (unsigned char a = X; a < Num_Axis; ++a)
|
for (unsigned char a = X; a < Num_Axis; ++a)
|
||||||
{
|
{
|
||||||
_set_axis_origin((EAxis)a, _get_axis_position((EAxis)a));
|
_set_axis_origin((EAxis)a, _get_axis_position((EAxis)a));
|
||||||
|
|
|
@ -40,7 +40,7 @@ const char* GCodeReader::parse_line_internal(const char *ptr, GCodeLine &gline,
|
||||||
if (is_end_of_gcode_line(*c))
|
if (is_end_of_gcode_line(*c))
|
||||||
break;
|
break;
|
||||||
// Check the name of the axis.
|
// Check the name of the axis.
|
||||||
Axis axis = NUM_AXES;
|
Axis axis = NUM_AXES_WITH_UNKNOWN;
|
||||||
switch (*c) {
|
switch (*c) {
|
||||||
case 'X': axis = X; break;
|
case 'X': axis = X; break;
|
||||||
case 'Y': axis = Y; break;
|
case 'Y': axis = Y; break;
|
||||||
|
@ -49,15 +49,19 @@ const char* GCodeReader::parse_line_internal(const char *ptr, GCodeLine &gline,
|
||||||
default:
|
default:
|
||||||
if (*c == m_extrusion_axis)
|
if (*c == m_extrusion_axis)
|
||||||
axis = E;
|
axis = E;
|
||||||
|
else if (*c >= 'A' && *c <= 'Z')
|
||||||
|
// Unknown axis, but we still want to remember that such a axis was seen.
|
||||||
|
axis = UNKNOWN_AXIS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (axis != NUM_AXES) {
|
if (axis != NUM_AXES_WITH_UNKNOWN) {
|
||||||
// Try to parse the numeric value.
|
// Try to parse the numeric value.
|
||||||
char *pend = nullptr;
|
char *pend = nullptr;
|
||||||
double v = strtod(++ c, &pend);
|
double v = strtod(++ c, &pend);
|
||||||
if (pend != nullptr && is_end_of_word(*pend)) {
|
if (pend != nullptr && is_end_of_word(*pend)) {
|
||||||
// The axis value has been parsed correctly.
|
// The axis value has been parsed correctly.
|
||||||
gline.m_axis[int(axis)] = float(v);
|
if (axis != UNKNOWN_AXIS)
|
||||||
|
gline.m_axis[int(axis)] = float(v);
|
||||||
gline.m_mask |= 1 << int(axis);
|
gline.m_mask |= 1 << int(axis);
|
||||||
c = pend;
|
c = pend;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -58,6 +58,7 @@ public:
|
||||||
bool has_z() const { return this->has(Z); }
|
bool has_z() const { return this->has(Z); }
|
||||||
bool has_e() const { return this->has(E); }
|
bool has_e() const { return this->has(E); }
|
||||||
bool has_f() const { return this->has(F); }
|
bool has_f() const { return this->has(F); }
|
||||||
|
bool has_unknown_axis() const { return this->has(UNKNOWN_AXIS); }
|
||||||
float x() const { return m_axis[X]; }
|
float x() const { return m_axis[X]; }
|
||||||
float y() const { return m_axis[Y]; }
|
float y() const { return m_axis[Y]; }
|
||||||
float z() const { return m_axis[Z]; }
|
float z() const { return m_axis[Z]; }
|
||||||
|
|
|
@ -98,7 +98,17 @@ extern Semver SEMVER;
|
||||||
template<typename T, typename Q>
|
template<typename T, typename Q>
|
||||||
inline T unscale(Q v) { return T(v) * T(SCALING_FACTOR); }
|
inline T unscale(Q v) { return T(v) * T(SCALING_FACTOR); }
|
||||||
|
|
||||||
enum Axis { X=0, Y, Z, E, F, NUM_AXES };
|
enum Axis {
|
||||||
|
X=0,
|
||||||
|
Y,
|
||||||
|
Z,
|
||||||
|
E,
|
||||||
|
F,
|
||||||
|
NUM_AXES,
|
||||||
|
// For the GCodeReader to mark a parsed axis, which is not in "XYZEF", it was parsed correctly.
|
||||||
|
UNKNOWN_AXIS = NUM_AXES,
|
||||||
|
NUM_AXES_WITH_UNKNOWN,
|
||||||
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
inline void append_to(std::vector<T> &dst, const std::vector<T> &src)
|
inline void append_to(std::vector<T> &dst, const std::vector<T> &src)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue