mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
Refactoring: moved most of the low-level G-code to the Slic3r::GCode::Base class. Cleanup of the retraction and wipe logic.
This commit is contained in:
parent
33edda0a69
commit
167df0ab87
11 changed files with 403 additions and 177 deletions
|
@ -21,13 +21,49 @@ Extruder::reset()
|
|||
double
|
||||
Extruder::extrude(double dE)
|
||||
{
|
||||
if (this->config->use_relative_e_distances) {
|
||||
// in case of relative E distances we always reset to 0 before any output
|
||||
if (this->config->use_relative_e_distances)
|
||||
this->E = 0;
|
||||
}
|
||||
|
||||
this->E += dE;
|
||||
this->absolute_E += dE;
|
||||
return this->E;
|
||||
return dE;
|
||||
}
|
||||
|
||||
/* This method makes sure the extruder is retracted by the specified amount
|
||||
of filament and returns the amount of filament retracted.
|
||||
If the extruder is already retracted by the same or a greater amount,
|
||||
this method is a no-op.
|
||||
The restart_extra argument sets the extra length to be used for
|
||||
unretraction. If we're actually performing a retraction, any restart_extra
|
||||
value supplied will overwrite the previous one if any. */
|
||||
double
|
||||
Extruder::retract(double length, double restart_extra)
|
||||
{
|
||||
// in case of relative E distances we always reset to 0 before any output
|
||||
if (this->config->use_relative_e_distances)
|
||||
this->E = 0;
|
||||
|
||||
double to_retract = length - this->retracted;
|
||||
if (to_retract > 0) {
|
||||
this->E -= to_retract;
|
||||
this->absolute_E -= to_retract;
|
||||
this->retracted += to_retract;
|
||||
this->restart_extra = restart_extra;
|
||||
return to_retract;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::unretract()
|
||||
{
|
||||
double dE = this->retracted + this->restart_extra;
|
||||
this->extrude(dE);
|
||||
this->retracted = 0;
|
||||
this->restart_extra = 0;
|
||||
return dE;
|
||||
}
|
||||
|
||||
Pointf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue