With single_extruder_multi_material enabled,

don't append a tool selection (Txx) to the extruder temperature
settings (M104 and M109).
This commit is contained in:
bubnikv 2017-05-25 22:52:28 +02:00
parent e000b22578
commit 2f4ff6577a
3 changed files with 16 additions and 19 deletions

View File

@ -511,7 +511,7 @@ bool GCode::do_export(FILE *file, Print &print)
}
// Calculate wiping points if needed
if (print.config.ooze_prevention.value) {
if (print.config.ooze_prevention.value && ! print.config.single_extruder_multi_material) {
Points skirt_points;
for (const ExtrusionEntity *ee : print.skirt.entities)
for (const ExtrusionPath &path : dynamic_cast<const ExtrusionLoop*>(ee)->paths)
@ -680,8 +680,6 @@ void GCode::_print_first_layer_extruder_temperatures(FILE *file, Print &print, u
if (print.config.single_extruder_multi_material.value) {
// Set temperature of the first printing extruder only.
int temp = print.config.first_layer_temperature.get_at(first_printing_extruder_id);
if (print.config.ooze_prevention.value)
temp += print.config.standby_temperature_delta.value;
if (temp > 0)
write(file, m_writer.set_temperature(temp, wait, first_printing_extruder_id));
} else {
@ -1985,7 +1983,7 @@ std::string GCode::set_extruder(unsigned int extruder_id)
m_wipe.reset_path();
// append custom toolchange G-code
if (m_writer.extruder() != NULL && !m_config.toolchange_gcode.value.empty()) {
if (m_writer.extruder() != nullptr && !m_config.toolchange_gcode.value.empty()) {
PlaceholderParser pp = m_placeholder_parser;
pp.set("previous_extruder", m_writer.extruder()->id);
pp.set("next_extruder", extruder_id);
@ -1994,7 +1992,7 @@ std::string GCode::set_extruder(unsigned int extruder_id)
// if ooze prevention is enabled, park current extruder in the nearest
// standby point and set it to the standby temperature
if (m_ooze_prevention.enable && m_writer.extruder() != NULL)
if (m_ooze_prevention.enable && m_writer.extruder() != nullptr)
gcode += m_ooze_prevention.pre_toolchange(*this);
// append the toolchange command
gcode += m_writer.toolchange(extruder_id);

View File

@ -13,15 +13,14 @@
namespace Slic3r {
void
GCodeWriter::apply_print_config(const PrintConfig &print_config)
void GCodeWriter::apply_print_config(const PrintConfig &print_config)
{
this->config.apply(print_config, true);
this->_extrusion_axis = this->config.get_extrusion_axis();
this->m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
}
void
GCodeWriter::set_extruders(const std::vector<unsigned int> &extruder_ids)
void GCodeWriter::set_extruders(const std::vector<unsigned int> &extruder_ids)
{
for (unsigned int extruder_id : extruder_ids)
this->extruders.insert(Extruder(extruder_id, &this->config));
@ -32,8 +31,7 @@ GCodeWriter::set_extruders(const std::vector<unsigned int> &extruder_ids)
this->multiple_extruders = (*std::max_element(extruder_ids.begin(), extruder_ids.end())) > 0;
}
std::string
GCodeWriter::preamble()
std::string GCodeWriter::preamble()
{
std::ostringstream gcode;
@ -53,8 +51,7 @@ GCodeWriter::preamble()
return gcode.str();
}
std::string
GCodeWriter::postamble() const
std::string GCodeWriter::postamble() const
{
std::ostringstream gcode;
if (FLAVOR_IS(gcfMachinekit))
@ -62,8 +59,7 @@ GCodeWriter::postamble() const
return gcode.str();
}
std::string
GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const
std::string GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) const
{
if (wait && (FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)))
return "";
@ -85,7 +81,9 @@ GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) cons
gcode << "S";
}
gcode << temperature;
if (tool != -1 && (this->multiple_extruders || FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish))) {
if (tool != -1 &&
( (this->multiple_extruders && ! this->m_single_extruder_multi_material) ||
FLAVOR_IS(gcfMakerWare) || FLAVOR_IS(gcfSailfish)) ) {
gcode << " T" << tool;
}
gcode << " ; " << comment << "\n";
@ -96,8 +94,7 @@ GCodeWriter::set_temperature(unsigned int temperature, bool wait, int tool) cons
return gcode.str();
}
std::string
GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait) const
std::string GCodeWriter::set_bed_temperature(unsigned int temperature, bool wait) const
{
std::string code, comment;
if (wait && FLAVOR_IS_NOT(gcfTeacup)) {

View File

@ -17,6 +17,7 @@ public:
GCodeWriter() :
multiple_extruders(false), _extrusion_axis("E"), _extruder(nullptr),
m_single_extruder_multi_material(false),
_last_acceleration(0), _last_fan_speed(0), _lifted(0)
{}
Extruder* extruder() { return this->_extruder; }
@ -61,12 +62,13 @@ public:
private:
std::string _extrusion_axis;
bool m_single_extruder_multi_material;
Extruder* _extruder;
unsigned int _last_acceleration;
unsigned int _last_fan_speed;
double _lifted;
Pointf3 _pos;
std::string _travel_to_z(double z, const std::string &comment);
std::string _retract(double length, double restart_extra, const std::string &comment);
};