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..7cc8afae1e 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 @@ -1479,7 +1483,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()