2014-04-07 23:42:29 +00:00
|
|
|
#include "Extruder.hpp"
|
2014-04-27 20:44:10 +00:00
|
|
|
#ifdef SLIC3RXS
|
|
|
|
#include "perlglue.hpp"
|
|
|
|
#endif
|
2014-04-07 23:42:29 +00:00
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2014-04-26 21:28:32 +00:00
|
|
|
Extruder::Extruder(int id, PrintConfig *config)
|
2014-04-07 23:42:29 +00:00
|
|
|
: id(id),
|
2014-04-26 21:28:32 +00:00
|
|
|
config(*config) // make a copy
|
2014-04-07 23:42:29 +00:00
|
|
|
{
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Extruder::reset()
|
|
|
|
{
|
|
|
|
this->E = 0;
|
|
|
|
this->absolute_E = 0;
|
|
|
|
this->retracted = 0;
|
|
|
|
this->restart_extra = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
Extruder::extrude(double dE)
|
|
|
|
{
|
2014-04-26 21:28:32 +00:00
|
|
|
if (this->use_relative_e_distances()) {
|
2014-04-07 23:42:29 +00:00
|
|
|
this->E = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
this->E += dE;
|
|
|
|
this->absolute_E += dE;
|
|
|
|
return this->E;
|
|
|
|
}
|
|
|
|
|
2014-04-26 21:28:32 +00:00
|
|
|
bool
|
|
|
|
Extruder::use_relative_e_distances() const
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
|
2014-04-27 20:44:10 +00:00
|
|
|
#ifdef SLIC3RXS
|
|
|
|
REGISTER_CLASS(Extruder, "Extruder");
|
|
|
|
#endif
|
|
|
|
|
2014-04-07 23:42:29 +00:00
|
|
|
}
|