Export of filament statistics into G-code for multi-material prints

has been rewritten to be easier to parse.

Old format
; filament used = 19248.8mm (46.3cm3)
; filament used = 57.4
; filament cost = 1.5
; filament used = 8007.6mm (19.3cm3)
; filament used = 23.9
; filament cost = 0.6
; filament used = 0.0mm (0.0cm3)
; filament used = 0.0mm (0.0cm3)
; filament used = 0.0mm (0.0cm3)
; total filament cost = 2.1

New format
; filament used [mm] = 1600.7,1600.7,1600.7,1600.7,1600.7
; filament used [cm3] = 3.9,3.9,3.9,3.9,3.9
; filament used [g] = 4.8,4.8,4.8,4.8,4.8
; filament cost = 1.5,1.5,1.5,1.5,1.5
; total filament used [g] = 24.0
; total filament cost = 7.5

Where the non-printing extruders are filled in with zeros, and
the trailing non-printing extruders are not exported.

; filament used [g]
and
; filament cost
are only printed if non zero (material density and cost are defined)
This commit is contained in:
bubnikv 2019-04-16 14:25:50 +02:00
parent 25bfebfe8e
commit d83a013d6b
2 changed files with 84 additions and 56 deletions

View file

@ -197,7 +197,7 @@ private:
const bool m_peters_wipe_tower = false; // sparse wipe tower inspired by Peter's post processor - not finished yet
const float Filament_Area = M_PI * 1.75f * 1.75f / 4.f; // filament area in mm^2
const float Filament_Area = float(M_PI * 1.75f * 1.75f / 4.f); // filament area in mm^2
const float Width_To_Nozzle_Ratio = 1.25f; // desired line width (oval) in multiples of nozzle diameter - may not be actually neccessary to adjust
const float WT_EPSILON = 1e-3f;
@ -224,8 +224,8 @@ private:
bool m_retain_speed_override = true;
bool m_adhesion = true;
float m_perimeter_width = 0.4 * Width_To_Nozzle_Ratio; // Width of an extrusion line, also a perimeter spacing for 100% infill.
float m_extrusion_flow = 0.038; //0.029f;// Extrusion flow is derived from m_perimeter_width, layer height and filament diameter.
float m_perimeter_width = 0.4f * Width_To_Nozzle_Ratio; // Width of an extrusion line, also a perimeter spacing for 100% infill.
float m_extrusion_flow = 0.038f; //0.029f;// Extrusion flow is derived from m_perimeter_width, layer height and filament diameter.
struct FilamentParameters {
@ -269,12 +269,12 @@ private:
{
if ( layer_height < 0 )
return m_extrusion_flow;
return layer_height * ( m_perimeter_width - layer_height * (1-M_PI/4.f)) / Filament_Area;
return layer_height * ( m_perimeter_width - layer_height * (1.f-float(M_PI)/4.f)) / Filament_Area;
}
// Calculates length of extrusion line to extrude given volume
float volume_to_length(float volume, float line_width, float layer_height) const {
return std::max(0., volume / (layer_height * (line_width - layer_height * (1. - M_PI / 4.))));
return std::max(0.f, volume / (layer_height * (line_width - layer_height * (1.f - float(M_PI) / 4.f))));
}
// Calculates depth for all layers and propagates them downwards