Reset wipe moves on tool change and on travel.

This commit is contained in:
bubnikv 2017-03-29 17:45:38 +02:00
parent 4bbb1f4b63
commit 5dc899d64e

View File

@ -261,13 +261,11 @@ GCode::set_extruders(const std::vector<unsigned int> &extruder_ids)
// enable wipe path generation if any extruder has wipe enabled // enable wipe path generation if any extruder has wipe enabled
this->wipe.enable = false; this->wipe.enable = false;
for (std::vector<unsigned int>::const_iterator it = extruder_ids.begin(); for (auto id : extruder_ids)
it != extruder_ids.end(); ++it) { if (this->config.wipe.get_at(id)) {
if (this->config.wipe.get_at(*it)) {
this->wipe.enable = true; this->wipe.enable = true;
break; break;
} }
}
} }
void void
@ -1001,7 +999,11 @@ GCode::travel_to(const Point &point, ExtrusionRole role, std::string comment)
// generate G-code for the travel move // generate G-code for the travel move
std::string gcode; std::string gcode;
if (needs_retraction) gcode += this->retract(); if (needs_retraction)
gcode += this->retract();
else
// Reset the wipe path when traveling, so one would not wipe along an old path.
this->wipe.reset_path();
// use G1 because we rely on paths being straight (G0 may make round paths) // use G1 because we rely on paths being straight (G0 may make round paths)
Lines lines = travel.lines(); Lines lines = travel.lines();
@ -1099,6 +1101,9 @@ GCode::set_extruder(unsigned int extruder_id)
// prepend retraction on the current extruder // prepend retraction on the current extruder
std::string gcode = this->retract(true); std::string gcode = this->retract(true);
// Always reset the extrusion path, even if the tool change retract is set to zero.
this->wipe.reset_path();
// append custom toolchange G-code // append custom toolchange G-code
if (this->writer.extruder() != NULL && !this->config.toolchange_gcode.value.empty()) { if (this->writer.extruder() != NULL && !this->config.toolchange_gcode.value.empty()) {
PlaceholderParser pp = *this->placeholder_parser; PlaceholderParser pp = *this->placeholder_parser;