#4936 - Take toolpaths width and height from gcode decorations, if available

This commit is contained in:
enricoturri1966 2020-12-08 15:55:53 +01:00
parent 1185ec9d2a
commit 5bd443cd1f
7 changed files with 177 additions and 11 deletions

View file

@ -1014,9 +1014,14 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
m_last_height = 0.f;
m_last_layer_z = 0.f;
m_max_layer_z = 0.f;
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
m_last_width = 0.f;
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_last_mm3_per_mm = 0.;
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
m_last_width = 0.f;
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
// How many times will be change_layer() called?
@ -2701,6 +2706,14 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
gcode += buf;
}
#if ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
if (last_was_wipe_tower || m_last_width != path.width) {
m_last_width = path.width;
sprintf(buf, ";%s%g\n", GCodeProcessor::Width_Tag.c_str(), m_last_width);
gcode += buf;
}
#endif // ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
if (last_was_wipe_tower || (m_last_mm3_per_mm != path.mm3_per_mm)) {
m_last_mm3_per_mm = path.mm3_per_mm;
@ -2708,11 +2721,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
gcode += buf;
}
#if !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
if (last_was_wipe_tower || m_last_width != path.width) {
m_last_width = path.width;
sprintf(buf, ";%s%g\n", GCodeProcessor::Width_Tag.c_str(), m_last_width);
gcode += buf;
}
#endif // !ENABLE_TOOLPATHS_WIDTH_HEIGHT_FROM_GCODE
#endif // ENABLE_GCODE_VIEWER_DATA_CHECKING
if (last_was_wipe_tower || std::abs(m_last_height - path.height) > EPSILON) {