Add weight/cost output to gcode. On the way to #647

This commit is contained in:
Joseph Lenox 2017-01-15 23:56:01 -06:00 committed by bubnikv
parent bbd63616b1
commit 3846d9e734
7 changed files with 63 additions and 1 deletions

View file

@ -111,6 +111,18 @@ Extruder::filament_diameter() const
return this->config->filament_diameter.get_at(this->id);
}
double
Extruder::filament_density() const
{
return this->config->filament_density.get_at(this->id);
}
double
Extruder::filament_cost() const
{
return this->config->filament_cost.get_at(this->id);
}
double
Extruder::extrusion_multiplier() const
{

View file

@ -29,6 +29,8 @@ class Extruder
double used_filament() const;
double filament_diameter() const;
double filament_density() const;
double filament_cost() const;
double extrusion_multiplier() const;
double retract_length() const;
double retract_lift() const;

View file

@ -335,6 +335,30 @@ PrintConfigDef::PrintConfigDef()
opt->values.push_back(3);
def->default_value = opt;
}
def = this->add("filament_density", coFloats);
def->label = "Density";
def->tooltip = "Enter your filament density here. This is only for statistical information. A decent way is to weigh a known length of filament and compute the ratio of the length to volume.";
def->sidetext = "g/mm^3";
def->cli = "filament-density=f@";
def->min = 0;
{
ConfigOptionFloats* opt = new ConfigOptionFloats();
opt->values.push_back(0);
def->default_value = opt;
}
def = this->add("filament_cost", coFloats);
def->label = "Cost";
def->tooltip = "Enter your filament cost per kg here. This is only for statistical information.";
def->sidetext = "money/kg";
def->cli = "filament-cost=f@";
def->min = 0;
{
ConfigOptionFloats* opt = new ConfigOptionFloats();
opt->values.push_back(0);
def->default_value = opt;
}
def = this->add("filament_settings_id", coString);
def->default_value = new ConfigOptionString("");

View file

@ -299,6 +299,8 @@ class GCodeConfig : public virtual StaticPrintConfig
ConfigOptionString extrusion_axis;
ConfigOptionFloats extrusion_multiplier;
ConfigOptionFloats filament_diameter;
ConfigOptionFloats filament_density;
ConfigOptionFloats filament_cost;
ConfigOptionFloats filament_max_volumetric_speed;
ConfigOptionBool gcode_comments;
ConfigOptionEnum<GCodeFlavor> gcode_flavor;
@ -334,6 +336,8 @@ class GCodeConfig : public virtual StaticPrintConfig
OPT_PTR(extrusion_axis);
OPT_PTR(extrusion_multiplier);
OPT_PTR(filament_diameter);
OPT_PTR(filament_density);
OPT_PTR(filament_cost);
OPT_PTR(filament_max_volumetric_speed);
OPT_PTR(gcode_comments);
OPT_PTR(gcode_flavor);