mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-03-13 06:46:11 -06:00
ENH: config: refine the object config logic when extruder count changes
1. add logic in CLI 2. add logic to process height range jira: no-jira Change-Id: I8a7ba1a78dacad7131cafa3fb8b742027276c7e8 (cherry picked from commit 9a6624653b7b66101f1a74715227a0f2b4588f16)
This commit is contained in:
parent
1297857f66
commit
ca5bd00d0e
2 changed files with 56 additions and 1 deletions
|
|
@ -3018,6 +3018,49 @@ int CLI::run(int argc, char **argv)
|
|||
m_models.emplace_back(std::move(m));
|
||||
}
|
||||
|
||||
|
||||
//update the object config due to extruder count change
|
||||
if ((machine_switch) && (new_extruder_count != current_extruder_count))
|
||||
{
|
||||
//process the object params here
|
||||
size_t num_objects = m_models[0].objects.size();
|
||||
for (int i = 0; i < num_objects; ++i) {
|
||||
ModelObject* object = m_models[0].objects[i];
|
||||
DynamicPrintConfig object_config = object->config.get();
|
||||
if (!object_config.empty()) {
|
||||
if (current_extruder_count < new_extruder_count)
|
||||
object_config.update_values_from_single_to_multi_2(m_print_config, print_options_with_variant);
|
||||
else
|
||||
object_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
object->config.assign_config(std::move(object_config));
|
||||
}
|
||||
for (ModelVolume* v : object->volumes) {
|
||||
if (v->is_model_part() || v->is_modifier()) {
|
||||
DynamicPrintConfig volume_config = v->config.get();
|
||||
if (!volume_config.empty()) {
|
||||
if (current_extruder_count < new_extruder_count)
|
||||
volume_config.update_values_from_single_to_multi_2(m_print_config, print_options_with_variant);
|
||||
else
|
||||
volume_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
v->config.assign_config(std::move(volume_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &layer_config_it : object->layer_config_ranges) {
|
||||
ModelConfig& layer_model_config = layer_config_it.second;
|
||||
DynamicPrintConfig layer_config = layer_model_config.get();
|
||||
if (!layer_config.empty()) {
|
||||
if (current_extruder_count < new_extruder_count)
|
||||
layer_config.update_values_from_single_to_multi_2(m_print_config, print_options_with_variant);
|
||||
else
|
||||
layer_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
layer_model_config.assign_config(std::move(layer_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//load custom gcodes into model if needed
|
||||
if ((custom_gcodes_map.size() > 0)&&(m_models.size() > 0))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5087,7 +5087,7 @@ void Tab::load_current_preset()
|
|||
object->config.assign_config(std::move(object_config));
|
||||
}
|
||||
for (ModelVolume* v : object->volumes) {
|
||||
if (v->is_model_part()) {
|
||||
if (v->is_model_part() || v->is_modifier()) {
|
||||
DynamicPrintConfig volume_config = v->config.get();
|
||||
if (!volume_config.empty()) {
|
||||
if (previous_extruder_count < new_extruder_count)
|
||||
|
|
@ -5098,6 +5098,18 @@ void Tab::load_current_preset()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &layer_config_it : object->layer_config_ranges) {
|
||||
ModelConfig& layer_model_config = layer_config_it.second;
|
||||
DynamicPrintConfig layer_config = layer_model_config.get();
|
||||
if (!layer_config.empty()) {
|
||||
if (previous_extruder_count < new_extruder_count)
|
||||
layer_config.update_values_from_single_to_multi_2(new_print_config, print_options_with_variant);
|
||||
else
|
||||
layer_config.update_values_from_multi_to_single_2(print_options_with_variant);
|
||||
layer_model_config.assign_config(std::move(layer_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue