From 78b42afbcb0eb8673544ca7b75f42855178f875d Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 10 Jan 2018 16:40:58 +0100 Subject: [PATCH 1/2] CURA-4776 Add unique id to the profiles so user can import the same profile several times with different names.It also fixes the issue for importing profiles from GCode. --- cura/Settings/CuraContainerRegistry.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index a0e2abd0b6..9202e57285 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -214,8 +214,6 @@ class CuraContainerRegistry(ContainerRegistry): name_seed = os.path.splitext(os.path.basename(file_name))[0] new_name = self.uniqueName(name_seed) - - # Ensure it is always a list of profiles if type(profile_or_list) is not list: profile_or_list = [profile_or_list] @@ -238,16 +236,6 @@ class CuraContainerRegistry(ContainerRegistry): else: #More extruders in the imported file than in the machine. continue #Delete the additional profiles. - # if the loaded profile comes from g-code then the instance containers should be - # defined differently - if extension == "gcode": - if profile.getMetaDataEntry("extruder") is None: - temp_defintion = profile.getMetaDataEntry("definition") - profile.metaData["id"] = (temp_defintion + "_" + new_name).lower() - elif profile.getMetaDataEntry("extruder") is not None: # be sure that extruder data exist - temp_extruder = profile.getMetaDataEntry("extruder") - profile.metaData["id"] = (temp_extruder + "_" + new_name).lower() - result = self._configureProfile(profile, profile_id, new_name) if result is not None: return {"status": "error", "message": catalog.i18nc( @@ -280,6 +268,10 @@ class CuraContainerRegistry(ContainerRegistry): profile._id = new_id profile.setName(new_name) + # Set the unique Id to the profile, so it's generating a new one even if the user imports the same profile + # It also solves an issue with importing profiles from G-Codes + profile.setMetaDataEntry("id", new_id) + if "type" in profile.getMetaData(): profile.setMetaDataEntry("type", "quality_changes") else: From 702d7dd3a838fa0bfe0f7aa152d376bc1cb46054 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 11 Jan 2018 08:23:17 +0100 Subject: [PATCH 2/2] Fix model importing with multi build plate CURA-4782 --- cura/CuraApplication.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index dfb78cd3b2..30fd461868 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1479,7 +1479,14 @@ class CuraApplication(QtApplication): # Step is for skipping tests to make it a lot faster. it also makes the outcome somewhat rougher node, _ = arranger.findNodePlacement(node, offset_shape_arr, hull_shape_arr, step = 10) - node.addDecorator(BuildPlateDecorator(target_build_plate)) + # This node is deepcopied from some other node which already has a BuildPlateDecorator, but the deepcopy + # of BuildPlateDecorator produces one that's assoicated with build plate -1. So, here we need to check if + # the BuildPlateDecorator exists or not and always set the correct build plate number. + build_plate_decorator = node.getDecorator(BuildPlateDecorator) + if build_plate_decorator is None: + build_plate_decorator = BuildPlateDecorator(target_build_plate) + node.addDecorator(build_plate_decorator) + build_plate_decorator.setBuildPlateNumber(target_build_plate) op = AddSceneNodeOperation(node, scene.getRoot()) op.push()