mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-04 09:58:44 +03:00
Prusa 2.7.2
This commit is contained in:
@@ -68,6 +68,21 @@ std::vector<std::pair<double, unsigned int>> custom_tool_changes(const Info& cus
|
||||
return custom_tool_changes;
|
||||
}
|
||||
|
||||
// Return pairs of <print_z, 1-based extruder ID> sorted by increasing print_z from custom_gcode_per_print_z.
|
||||
// Where print_z corresponds to the layer on which we perform a color change for the specified extruder.
|
||||
std::vector<std::pair<double, unsigned int>> custom_color_changes(const Info& custom_gcode_per_print_z, size_t num_extruders)
|
||||
{
|
||||
std::vector<std::pair<double, unsigned int>> custom_color_changes;
|
||||
for (const Item& custom_gcode : custom_gcode_per_print_z.gcodes)
|
||||
if (custom_gcode.type == ColorChange) {
|
||||
// If extruder count in PrinterSettings was changed, ignore custom g-codes for extruder ids bigger than num_extruders.
|
||||
assert(custom_gcode.extruder >= 0);
|
||||
if (size_t(custom_gcode.extruder) <= num_extruders) {
|
||||
custom_color_changes.emplace_back(custom_gcode.print_z, static_cast<unsigned int>(custom_gcode.extruder));
|
||||
}
|
||||
}
|
||||
return custom_color_changes;
|
||||
}
|
||||
} // namespace CustomGCode
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
Reference in New Issue
Block a user