mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-22 16:21:24 -06:00
Some minor changes to the newly-ported Extruder class
This commit is contained in:
parent
4c330b6c59
commit
24571612c7
6 changed files with 33 additions and 64 deletions
|
@ -24,7 +24,7 @@ Extruder::reset()
|
|||
double
|
||||
Extruder::extrude(double dE)
|
||||
{
|
||||
if (this->use_relative_e_distances()) {
|
||||
if (this->config->use_relative_e_distances) {
|
||||
this->E = 0;
|
||||
}
|
||||
|
||||
|
@ -33,116 +33,94 @@ Extruder::extrude(double dE)
|
|||
return this->E;
|
||||
}
|
||||
|
||||
template <typename Val, class OptType> Val
|
||||
Extruder::get_config(const char *name) const
|
||||
{
|
||||
// TODO: figure out way to avoid static_cast to access hidden const method
|
||||
const ConfigOption *opt = static_cast<const ConfigBase*>(this->config)
|
||||
->option(name);
|
||||
return dynamic_cast<const OptType *>(opt)->get_at(this->id);
|
||||
}
|
||||
|
||||
bool
|
||||
Extruder::use_relative_e_distances() const
|
||||
{
|
||||
// not using get_config because use_relative_e_distances is global
|
||||
// for all extruders
|
||||
|
||||
// TODO: figure out way to avoid static_cast to access hidden const method
|
||||
const ConfigOption *opt = static_cast<const ConfigBase*>(this->config)
|
||||
->option("use_relative_e_distances");
|
||||
return *static_cast<const ConfigOptionBool*>(opt);
|
||||
}
|
||||
|
||||
Pointf
|
||||
Extruder::extruder_offset() const
|
||||
{
|
||||
return get_config<Pointf, ConfigOptionPoints>("extruder_offset");
|
||||
return this->config->extruder_offset.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::nozzle_diameter() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("nozzle_diameter");
|
||||
return this->config->nozzle_diameter.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::filament_diameter() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("filament_diameter");
|
||||
return this->config->filament_diameter.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::extrusion_multiplier() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("extrusion_multiplier");
|
||||
return this->config->extrusion_multiplier.get_at(this->id);
|
||||
}
|
||||
|
||||
int
|
||||
Extruder::temperature() const
|
||||
{
|
||||
return get_config<int, ConfigOptionInts>("temperature");
|
||||
return this->config->temperature.get_at(this->id);
|
||||
}
|
||||
|
||||
int
|
||||
Extruder::first_layer_temperature() const
|
||||
{
|
||||
return get_config<int, ConfigOptionInts>("first_layer_temperature");
|
||||
return this->config->first_layer_temperature.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_length() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_length");
|
||||
return this->config->retract_length.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_lift() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_lift");
|
||||
return this->config->retract_lift.get_at(this->id);
|
||||
}
|
||||
|
||||
int
|
||||
Extruder::retract_speed() const
|
||||
{
|
||||
return get_config<int, ConfigOptionInts>("retract_speed");
|
||||
return this->config->retract_speed.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_restart_extra() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_restart_extra");
|
||||
return this->config->retract_restart_extra.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_before_travel() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_before_travel");
|
||||
return this->config->retract_before_travel.get_at(this->id);
|
||||
}
|
||||
|
||||
bool
|
||||
Extruder::retract_layer_change() const
|
||||
{
|
||||
return get_config<bool, ConfigOptionBools>("retract_layer_change");
|
||||
return this->config->retract_layer_change.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_length_toolchange() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>("retract_length_toolchange");
|
||||
return this->config->retract_length_toolchange.get_at(this->id);
|
||||
}
|
||||
|
||||
double
|
||||
Extruder::retract_restart_extra_toolchange() const
|
||||
{
|
||||
return get_config<double, ConfigOptionFloats>(
|
||||
"retract_restart_extra_toolchange");
|
||||
return this->config->retract_restart_extra_toolchange.get_at(this->id);
|
||||
}
|
||||
|
||||
bool
|
||||
Extruder::wipe() const
|
||||
{
|
||||
return get_config<bool, ConfigOptionBools>("wipe");
|
||||
return this->config->wipe.get_at(this->id);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,9 +14,8 @@ class Extruder
|
|||
virtual ~Extruder() {}
|
||||
void reset();
|
||||
double extrude(double dE);
|
||||
|
||||
|
||||
bool use_relative_e_distances() const;
|
||||
|
||||
|
||||
Pointf extruder_offset() const;
|
||||
double nozzle_diameter() const;
|
||||
double filament_diameter() const;
|
||||
|
@ -32,21 +31,14 @@ class Extruder
|
|||
double retract_length_toolchange() const;
|
||||
double retract_restart_extra_toolchange() const;
|
||||
bool wipe() const;
|
||||
|
||||
|
||||
int id;
|
||||
double E;
|
||||
double absolute_E;
|
||||
double retracted;
|
||||
double restart_extra;
|
||||
|
||||
|
||||
PrintConfig *config;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// get value from a ConfigOptionVector subtype, indexed by extruder id
|
||||
template <typename Val, class OptType>
|
||||
Val get_config(const char *name) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue