From 98cb1052d9dd08b7003ad0050ada44019621f379 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 26 Aug 2024 10:52:47 +0200 Subject: [PATCH] Refactor to use existing mesh group object assuming that cloud slicer does not create multiple mesh groups, but one. NP-351 --- src/communication/CommandLine.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/communication/CommandLine.cpp b/src/communication/CommandLine.cpp index 05a3691def..80db95519e 100644 --- a/src/communication/CommandLine.cpp +++ b/src/communication/CommandLine.cpp @@ -437,23 +437,19 @@ void CommandLine::sliceNext() for (const auto& [key, values] : model_settings) { const auto& model_name = key; - - cura::MeshGroup mesh_group; for (const auto& [setting_key, setting_value] : values) { - mesh_group.settings.add(setting_key, setting_value); + slice->scene.mesh_groups[mesh_group_index].settings.add(setting_key, setting_value); } - const auto transformation = mesh_group.settings.get("mesh_rotation_matrix"); - const auto extruder_nr = mesh_group.settings.get("extruder_nr"); + const auto transformation = slice->scene.mesh_groups[mesh_group_index].settings.get("mesh_rotation_matrix"); + const auto extruder_nr = slice->scene.mesh_groups[mesh_group_index].settings.get("extruder_nr"); - if (! loadMeshIntoMeshGroup(&mesh_group, model_name.c_str(), transformation, slice->scene.extruders[extruder_nr].settings_)) + if (! loadMeshIntoMeshGroup(&slice->scene.mesh_groups[mesh_group_index], model_name.c_str(), transformation, slice->scene.extruders[extruder_nr].settings_)) { spdlog::error("Failed to load model: {}. (error number {})", model_name, errno); exit(1); } - - slice->scene.mesh_groups.push_back(std::move(mesh_group)); } for (const auto& [key, value] : limit_to_extruder) {