GCodeGenerator / custom G-codes: Added new read/only options providing

the amount of total extruded material and per extruder extruded material
up to the point the value is evaluated:
"extruded_volume", "extruded_weight",
"extruded_volume_total", "extruded_weight_total"
This commit is contained in:
Vojtech Bubnik 2023-03-30 10:36:23 +02:00 committed by SoftFever
parent 05194ab1f4
commit 0c3802ac4c
5 changed files with 249 additions and 54 deletions

View file

@ -94,6 +94,24 @@ double Extruder::unretract()
}
}
// Setting the retract state from the script.
// Sets current retraction value & restart extra filament amount if retracted > 0.
void Extruder::set_retracted(double retracted, double restart_extra)
{
if (retracted < - EPSILON)
throw Slic3r::RuntimeError("Custom G-code reports negative z_retracted.");
if (restart_extra < - EPSILON)
throw Slic3r::RuntimeError("Custom G-code reports negative z_restart_extra.");
if (retracted > EPSILON) {
m_retracted = retracted;
m_restart_extra = restart_extra < EPSILON ? 0 : restart_extra;
} else {
m_retracted = 0;
m_restart_extra = 0;
}
}
// Used filament volume in mm^3.
double Extruder::extruded_volume() const
{