Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-02-15 19:51:46 +0300
committerbubnikv <bubnikv@gmail.com>2017-02-15 19:51:46 +0300
commit3bfa6416d87f920d4656c3ab602f02ef41e33180 (patch)
tree097751066f461855782fb8bc4bb868398963e4af
parent2ddabe5fa8e40519f8a5df4eda7ca8ebd3a265b0 (diff)
Fixed https://github.com/prusa3d/Slic3r/issues/126version_1.33.4
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.
-rw-r--r--xs/src/libslic3r/ExtrusionEntity.cpp20
-rw-r--r--xs/src/libslic3r/GCode.cpp37
-rw-r--r--xs/src/libslic3r/GCode.hpp4
3 files changed, 31 insertions, 30 deletions
diff --git a/xs/src/libslic3r/ExtrusionEntity.cpp b/xs/src/libslic3r/ExtrusionEntity.cpp
index dc7cfe061..880dcaad0 100644
--- a/xs/src/libslic3r/ExtrusionEntity.cpp
+++ b/xs/src/libslic3r/ExtrusionEntity.cpp
@@ -100,17 +100,17 @@ double ExtrusionMultiPath::min_mm3_per_mm() 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;
- 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.push_back(paths.front().polyline.points.front());
for (size_t i_path = 0; i_path < paths.size(); ++ i_path)
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index 2aeb7fc60..77b4932ef 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -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
due to rounding (TODO: test and/or better math for this) */
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.extrude_to_xy(
gcodegen.point_to_gcode(line->b),
@@ -730,10 +732,12 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
// extrude along the path
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 += ExtrusionRole2String(path->role);
+ path->simplify(SCALED_RESOLUTION);
gcode += this->_extrude(*path, description, speed);
+ }
// reset acceleration
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
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 += ExtrusionRole2String(path->role);
+ path->simplify(SCALED_RESOLUTION);
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
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;
}
@@ -814,22 +818,23 @@ GCode::extrude(const ExtrusionEntity &entity, std::string description, double sp
}
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);
+ path.simplify(SCALED_RESOLUTION);
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
gcode += this->writer.set_acceleration(this->config.default_acceleration.value);
-
return gcode;
}
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;
// 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)
gcode += ";_BRIDGE_FAN_END\n";
diff --git a/xs/src/libslic3r/GCode.hpp b/xs/src/libslic3r/GCode.hpp
index 51a77f41c..8fe94edc9 100644
--- a/xs/src/libslic3r/GCode.hpp
+++ b/xs/src/libslic3r/GCode.hpp
@@ -122,7 +122,7 @@ class GCode {
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(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);
bool needs_retraction(const Polyline &travel, ExtrusionRole role = erNone);
std::string retract(bool toolchange = false);
@@ -133,7 +133,7 @@ class GCode {
private:
Point _last_pos;
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);
};
}