mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
Refactoring of GCode::process_layer().
Refactoring of GCode export of color changes, extruder switches etc, so that the "color change" like extruder switches are applied first at the Wipe Tower / G-code export, so that adding / removing an extruder switch at the G-code preview slider does not invalidate slicing.
This commit is contained in:
parent
79d7a0130f
commit
8bfc986fa7
13 changed files with 352 additions and 295 deletions
|
@ -19,8 +19,8 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
|
|||
this->config.apply(print_config, true);
|
||||
m_extrusion_axis = this->config.get_extrusion_axis();
|
||||
m_single_extruder_multi_material = print_config.single_extruder_multi_material.value;
|
||||
m_max_acceleration = (print_config.gcode_flavor.value == gcfMarlin) ?
|
||||
print_config.machine_max_acceleration_extruding.values.front() : 0;
|
||||
m_max_acceleration = std::lrint((print_config.gcode_flavor.value == gcfMarlin) ?
|
||||
print_config.machine_max_acceleration_extruding.values.front() : 0);
|
||||
}
|
||||
|
||||
void GCodeWriter::set_extruders(const std::vector<unsigned int> &extruder_ids)
|
||||
|
@ -247,9 +247,9 @@ std::string GCodeWriter::toolchange_prefix() const
|
|||
std::string GCodeWriter::toolchange(unsigned int extruder_id)
|
||||
{
|
||||
// set the new extruder
|
||||
auto it_extruder = std::lower_bound(m_extruders.begin(), m_extruders.end(), Extruder::key(extruder_id));
|
||||
assert(it_extruder != m_extruders.end());
|
||||
m_extruder = const_cast<Extruder*>(&*it_extruder);
|
||||
auto it_extruder = Slic3r::lower_bound_by_predicate(m_extruders.begin(), m_extruders.end(), [extruder_id](const Extruder &e) { return e.id() < extruder_id; });
|
||||
assert(it_extruder != m_extruders.end() && it_extruder->id() == extruder_id);
|
||||
m_extruder = &*it_extruder;
|
||||
|
||||
// return the toolchange command
|
||||
// if we are running a single-extruder setup, just set the extruder and return nothing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue