mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-15 13:42:40 -07:00
Fix of https://github.com/alexrj/Slic3r/issues/4043 , thanks to @lordofhyphens.
Further refactoring of the cooling logic to collect per extruder data.
This commit is contained in:
@@ -26,6 +26,11 @@ void GCodeWriter::set_extruders(const std::vector<unsigned int> &extruder_ids)
|
||||
m_extruders.reserve(extruder_ids.size());
|
||||
for (unsigned int extruder_id : extruder_ids)
|
||||
m_extruders.emplace_back(Extruder(extruder_id, &this->config));
|
||||
|
||||
m_elapsed_times.clear();
|
||||
m_elapsed_times.reserve(extruder_ids.size());
|
||||
for (unsigned int extruder_id : extruder_ids)
|
||||
m_elapsed_times.emplace_back(ElapsedTime(extruder_id));
|
||||
|
||||
/* we enable support for multiple extruder if any extruder greater than 0 is used
|
||||
(even if prints only uses that one) since we need to output Tx commands
|
||||
@@ -235,6 +240,10 @@ std::string GCodeWriter::toolchange(unsigned int extruder_id)
|
||||
assert(it_extruder != m_extruders.end());
|
||||
m_extruder = const_cast<Extruder*>(&*it_extruder);
|
||||
|
||||
auto it_elapsed_time = std::lower_bound(m_elapsed_times.begin(), m_elapsed_times.end(), ElapsedTime(extruder_id));
|
||||
assert(it_elapsed_time != m_elapsed_times.end());
|
||||
m_elapsed_time = const_cast<ElapsedTime*>(&*it_elapsed_time);
|
||||
|
||||
// return the toolchange command
|
||||
// if we are running a single-extruder setup, just set the extruder and return nothing
|
||||
std::ostringstream gcode;
|
||||
|
||||
Reference in New Issue
Block a user