mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
Merge pull request #3303 from hyperair/fix-cooldown
Changes to properly detect extrusion moves for "layer cooldown" slowdowns and properly calculate time required to complete moves.
This commit is contained in:
commit
510ca9f9e2
5 changed files with 28 additions and 13 deletions
|
@ -177,11 +177,11 @@ 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;
|
||||
gcode += gcodegen.writer.set_speed(wipe_speed*60);
|
||||
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),
|
||||
-dE,
|
||||
(std::string)"wipe and retract" + (gcodegen.enable_cooling_markers ? ";_WIPE" : "")
|
||||
"wipe and retract"
|
||||
);
|
||||
retracted += dE;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
|
|||
|
||||
GCode::GCode()
|
||||
: placeholder_parser(NULL), enable_loop_clipping(true), enable_cooling_markers(false), layer_count(0),
|
||||
layer_index(-1), layer(NULL), first_layer(false), elapsed_time(0), volumetric_speed(0),
|
||||
layer_index(-1), layer(NULL), first_layer(false), elapsed_time(0.0), volumetric_speed(0),
|
||||
_last_pos_defined(false)
|
||||
{
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
|
|||
// extrude arc or line
|
||||
if (path.is_bridge() && this->enable_cooling_markers)
|
||||
gcode += ";_BRIDGE_FAN_START\n";
|
||||
gcode += this->writer.set_speed(F);
|
||||
gcode += this->writer.set_speed(F, this->enable_cooling_markers ? ";_EXTRUDE_SET_SPEED" : "");
|
||||
double path_length = 0;
|
||||
{
|
||||
std::string comment = this->config.gcode_comments ? description : "";
|
||||
|
@ -629,9 +629,17 @@ GCode::travel_to(const Point &point, ExtrusionRole role, std::string comment)
|
|||
|
||||
// use G1 because we rely on paths being straight (G0 may make round paths)
|
||||
Lines lines = travel.lines();
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line)
|
||||
gcode += this->writer.travel_to_xy(this->point_to_gcode(line->b), comment);
|
||||
|
||||
double path_length = 0;
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
|
||||
const double line_length = line->length() * SCALING_FACTOR;
|
||||
path_length += line_length;
|
||||
|
||||
gcode += this->writer.travel_to_xy(this->point_to_gcode(line->b), comment);
|
||||
}
|
||||
|
||||
if (this->config.cooling)
|
||||
this->elapsed_time += path_length / this->config.get_abs_value("travel_speed");
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class GCode {
|
|||
const Layer* layer;
|
||||
std::map<const PrintObject*,Point> _seam_position;
|
||||
bool first_layer; // this flag triggers first layer speeds
|
||||
unsigned int elapsed_time; // seconds
|
||||
float elapsed_time; // seconds
|
||||
double volumetric_speed;
|
||||
|
||||
GCode();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue