by re-shuffling the simplification of a path to be extruded. A non-simplified path was being used for a wipe move before, causing an extremely detailed path to be exported into a G-code.
This commit is contained in:
parent
2ddabe5fa8
commit
3bfa6416d8
@ -100,17 +100,17 @@ double ExtrusionMultiPath::min_mm3_per_mm() const
|
|||||||
|
|
||||||
Polyline ExtrusionMultiPath::as_polyline() const
|
Polyline ExtrusionMultiPath::as_polyline() const
|
||||||
{
|
{
|
||||||
size_t len = 0;
|
|
||||||
for (size_t i_path = 0; i_path < paths.size(); ++ i_path) {
|
|
||||||
assert(! paths[i_path].polyline.points.empty());
|
|
||||||
assert(i_path == 0 || paths[i_path - 1].polyline.points.back() == paths[i_path].polyline.points.front());
|
|
||||||
len += paths[i_path].polyline.points.size();
|
|
||||||
}
|
|
||||||
// The connecting points between the segments are equal.
|
|
||||||
len -= paths.size() - 1;
|
|
||||||
|
|
||||||
Polyline out;
|
Polyline out;
|
||||||
if (len > 0) {
|
if (! paths.empty()) {
|
||||||
|
size_t len = 0;
|
||||||
|
for (size_t i_path = 0; i_path < paths.size(); ++ i_path) {
|
||||||
|
assert(! paths[i_path].polyline.points.empty());
|
||||||
|
assert(i_path == 0 || paths[i_path - 1].polyline.points.back() == paths[i_path].polyline.points.front());
|
||||||
|
len += paths[i_path].polyline.points.size();
|
||||||
|
}
|
||||||
|
// The connecting points between the segments are equal.
|
||||||
|
len -= paths.size() - 1;
|
||||||
|
assert(len > 0);
|
||||||
out.points.reserve(len);
|
out.points.reserve(len);
|
||||||
out.points.push_back(paths.front().polyline.points.front());
|
out.points.push_back(paths.front().polyline.points.front());
|
||||||
for (size_t i_path = 0; i_path < paths.size(); ++ i_path)
|
for (size_t i_path = 0; i_path < paths.size(); ++ i_path)
|
||||||
|
@ -190,6 +190,8 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
|
|||||||
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
|
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
|
||||||
due to rounding (TODO: test and/or better math for this) */
|
due to rounding (TODO: test and/or better math for this) */
|
||||||
double dE = length * (segment_length / wipe_dist) * 0.95;
|
double dE = length * (segment_length / wipe_dist) * 0.95;
|
||||||
|
//FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle.
|
||||||
|
// Is it here for the cooling markers? Or should it be outside of the cycle?
|
||||||
gcode += gcodegen.writer.set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers ? ";_WIPE" : "");
|
gcode += gcodegen.writer.set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers ? ";_WIPE" : "");
|
||||||
gcode += gcodegen.writer.extrude_to_xy(
|
gcode += gcodegen.writer.extrude_to_xy(
|
||||||
gcodegen.point_to_gcode(line->b),
|
gcodegen.point_to_gcode(line->b),
|
||||||
@ -730,10 +732,12 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
|
|||||||
|
|
||||||
// extrude along the path
|
// extrude along the path
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
for (ExtrusionPaths::const_iterator path = paths.begin(); path != paths.end(); ++path)
|
for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) {
|
||||||
// description += ExtrusionLoopRole2String(loop.role);
|
// description += ExtrusionLoopRole2String(loop.role);
|
||||||
// description += ExtrusionRole2String(path->role);
|
// description += ExtrusionRole2String(path->role);
|
||||||
|
path->simplify(SCALED_RESOLUTION);
|
||||||
gcode += this->_extrude(*path, description, speed);
|
gcode += this->_extrude(*path, description, speed);
|
||||||
|
}
|
||||||
|
|
||||||
// reset acceleration
|
// reset acceleration
|
||||||
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
|
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
|
||||||
@ -783,18 +787,18 @@ GCode::extrude(ExtrusionMultiPath multipath, std::string description, double spe
|
|||||||
{
|
{
|
||||||
// extrude along the path
|
// extrude along the path
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
for (ExtrusionPaths::const_iterator path = multipath.paths.begin(); path != multipath.paths.end(); ++path)
|
for (ExtrusionPaths::iterator path = multipath.paths.begin(); path != multipath.paths.end(); ++path) {
|
||||||
// description += ExtrusionLoopRole2String(loop.role);
|
// description += ExtrusionLoopRole2String(loop.role);
|
||||||
// description += ExtrusionRole2String(path->role);
|
// description += ExtrusionRole2String(path->role);
|
||||||
|
path->simplify(SCALED_RESOLUTION);
|
||||||
gcode += this->_extrude(*path, description, speed);
|
gcode += this->_extrude(*path, description, speed);
|
||||||
|
}
|
||||||
|
if (this->wipe.enable) {
|
||||||
|
this->wipe.path = std::move(multipath.paths.back().polyline); // TODO: don't limit wipe to last path
|
||||||
|
this->wipe.path.reverse();
|
||||||
|
}
|
||||||
// reset acceleration
|
// reset acceleration
|
||||||
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
|
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
|
||||||
|
|
||||||
//FIXME perform wipe on multi paths?
|
|
||||||
// if (this->wipe.enable)
|
|
||||||
// this->wipe.path = paths.front().polyline; // TODO: don't limit wipe to last path
|
|
||||||
|
|
||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,22 +818,23 @@ GCode::extrude(const ExtrusionEntity &entity, std::string description, double sp
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
GCode::extrude(const ExtrusionPath &path, std::string description, double speed)
|
GCode::extrude(ExtrusionPath path, std::string description, double speed)
|
||||||
{
|
{
|
||||||
// description += ExtrusionRole2String(path.role);
|
// description += ExtrusionRole2String(path.role);
|
||||||
|
path.simplify(SCALED_RESOLUTION);
|
||||||
std::string gcode = this->_extrude(path, description, speed);
|
std::string gcode = this->_extrude(path, description, speed);
|
||||||
|
if (this->wipe.enable) {
|
||||||
|
this->wipe.path = std::move(path.polyline);
|
||||||
|
this->wipe.path.reverse();
|
||||||
|
}
|
||||||
// reset acceleration
|
// reset acceleration
|
||||||
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
|
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
|
||||||
|
|
||||||
return gcode;
|
return gcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
GCode::_extrude(ExtrusionPath path, std::string description, double speed)
|
GCode::_extrude(const ExtrusionPath &path, std::string description, double speed)
|
||||||
{
|
{
|
||||||
path.simplify(SCALED_RESOLUTION);
|
|
||||||
|
|
||||||
std::string gcode;
|
std::string gcode;
|
||||||
|
|
||||||
// go to first point of extrusion path
|
// go to first point of extrusion path
|
||||||
@ -934,10 +939,6 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this->wipe.enable) {
|
|
||||||
this->wipe.path = path.polyline;
|
|
||||||
this->wipe.path.reverse();
|
|
||||||
}
|
|
||||||
if (path.is_bridge() && this->enable_cooling_markers)
|
if (path.is_bridge() && this->enable_cooling_markers)
|
||||||
gcode += ";_BRIDGE_FAN_END\n";
|
gcode += ";_BRIDGE_FAN_END\n";
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class GCode {
|
|||||||
std::string extrude(const ExtrusionEntity &entity, std::string description = "", double speed = -1);
|
std::string extrude(const ExtrusionEntity &entity, std::string description = "", double speed = -1);
|
||||||
std::string extrude(ExtrusionLoop loop, std::string description = "", double speed = -1);
|
std::string extrude(ExtrusionLoop loop, std::string description = "", double speed = -1);
|
||||||
std::string extrude(ExtrusionMultiPath multipath, std::string description = "", double speed = -1);
|
std::string extrude(ExtrusionMultiPath multipath, std::string description = "", double speed = -1);
|
||||||
std::string extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
std::string extrude(ExtrusionPath path, std::string description = "", double speed = -1);
|
||||||
std::string travel_to(const Point &point, ExtrusionRole role, std::string comment);
|
std::string travel_to(const Point &point, ExtrusionRole role, std::string comment);
|
||||||
bool needs_retraction(const Polyline &travel, ExtrusionRole role = erNone);
|
bool needs_retraction(const Polyline &travel, ExtrusionRole role = erNone);
|
||||||
std::string retract(bool toolchange = false);
|
std::string retract(bool toolchange = false);
|
||||||
@ -133,7 +133,7 @@ class GCode {
|
|||||||
private:
|
private:
|
||||||
Point _last_pos;
|
Point _last_pos;
|
||||||
bool _last_pos_defined;
|
bool _last_pos_defined;
|
||||||
std::string _extrude(ExtrusionPath path, std::string description = "", double speed = -1);
|
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user