mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-16 08:12:39 -07:00
Code refactoring for Color change implementation
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "SVG.hpp"
|
||||
#include <Eigen/Dense>
|
||||
#include "GCodeWriter.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -43,7 +44,7 @@ Model& Model::assign_copy(const Model &rhs)
|
||||
}
|
||||
|
||||
// copy custom code per height
|
||||
this->custom_gcode_per_height = rhs.custom_gcode_per_height;
|
||||
this->custom_gcode_per_print_z = rhs.custom_gcode_per_print_z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ Model& Model::assign_copy(Model &&rhs)
|
||||
rhs.objects.clear();
|
||||
|
||||
// copy custom code per height
|
||||
this->custom_gcode_per_height = rhs.custom_gcode_per_height;
|
||||
this->custom_gcode_per_print_z = rhs.custom_gcode_per_print_z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -595,16 +596,15 @@ std::string Model::propose_export_file_name_and_path(const std::string &new_exte
|
||||
std::vector<std::pair<double, DynamicPrintConfig>> Model::get_custom_tool_changes(double default_layer_height, size_t num_extruders) const
|
||||
{
|
||||
std::vector<std::pair<double, DynamicPrintConfig>> custom_tool_changes;
|
||||
if (!custom_gcode_per_height.empty()) {
|
||||
for (const CustomGCode& custom_gcode : custom_gcode_per_height)
|
||||
if (custom_gcode.gcode == ExtruderChangeCode) {
|
||||
DynamicPrintConfig config;
|
||||
// If extruder count in PrinterSettings was changed, use default (0) extruder for extruders, more than num_extruders
|
||||
config.set_key_value("extruder", new ConfigOptionInt(custom_gcode.extruder > num_extruders ? 0 : custom_gcode.extruder));
|
||||
// For correct extruders(tools) changing, we should decrease custom_gcode.height value by one default layer height
|
||||
custom_tool_changes.push_back({ custom_gcode.height - default_layer_height, config });
|
||||
}
|
||||
}
|
||||
for (const CustomGCode& custom_gcode : custom_gcode_per_print_z)
|
||||
if (custom_gcode.gcode == ExtruderChangeCode) {
|
||||
DynamicPrintConfig config;
|
||||
// If extruder count in PrinterSettings was changed, use default (0) extruder for extruders, more than num_extruders
|
||||
config.set_key_value("extruder", new ConfigOptionInt(custom_gcode.extruder > num_extruders ? 0 : custom_gcode.extruder));
|
||||
// For correct extruders(tools) changing, we should decrease custom_gcode.height value by one default layer height
|
||||
custom_tool_changes.push_back({ custom_gcode.print_z - default_layer_height, config });
|
||||
}
|
||||
|
||||
return custom_tool_changes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user