From 702d7dd3a838fa0bfe0f7aa152d376bc1cb46054 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 11 Jan 2018 08:23:17 +0100 Subject: [PATCH 1/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() From b9a99d46922ff52214b7012ed8dea50a89d8524b Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 11 Jan 2018 09:33:07 +0100 Subject: [PATCH 2/2] CURA-4525 fix placement on load to only avoid objects on current build plate --- cura/CuraActions.py | 2 +- cura/CuraApplication.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cura/CuraActions.py b/cura/CuraActions.py index 2474e218e8..f5aace805b 100644 --- a/cura/CuraActions.py +++ b/cura/CuraActions.py @@ -73,7 +73,7 @@ class CuraActions(QObject): # \param count The number of times to multiply the selection. @pyqtSlot(int) def multiplySelection(self, count: int) -> None: - job = MultiplyObjectsJob(Selection.getAllSelectedObjects(), count, 8) + job = MultiplyObjectsJob(Selection.getAllSelectedObjects(), count, min_offset = 8) job.start() ## Delete all selected objects. diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index dfb78cd3b2..a2ce5c322c 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1421,16 +1421,20 @@ class CuraApplication(QtApplication): filename = job.getFileName() self._currently_loading_files.remove(filename) - root = self.getController().getScene().getRoot() - arranger = Arrange.create(scene_root = root) - min_offset = 8 - self.fileLoaded.emit(filename) arrange_objects_on_load = ( not Preferences.getInstance().getValue("cura/use_multi_build_plate") or not Preferences.getInstance().getValue("cura/not_arrange_objects_on_load")) target_build_plate = self.getBuildPlateModel().activeBuildPlate if arrange_objects_on_load else -1 + root = self.getController().getScene().getRoot() + fixed_nodes = [] + for node_ in DepthFirstIterator(root): + if node_.callDecoration("isSliceable") and node_.callDecoration("getBuildPlateNumber") == target_build_plate: + fixed_nodes.append(node_) + arranger = Arrange.create(fixed_nodes = fixed_nodes) + min_offset = 8 + for original_node in nodes: # Create a CuraSceneNode just if the original node is not that type