diff --git a/cura/Arrange.py b/cura/Arrange.py index 225e512c2f..b9d2b2492a 100755 --- a/cura/Arrange.py +++ b/cura/Arrange.py @@ -84,11 +84,13 @@ class Arrange: if x is not None: # We could find a place new_node.setPosition(Vector(x, center_y, y)) + found_spot = True self.place(x, y, hull_shape_arr) # place the object in arranger else: - Logger.log("d", "Could not find spot!") + Logger.log("d", "Could not find spot!"), + found_spot = False new_node.setPosition(Vector(200, center_y, 100)) - return new_node + return new_node, found_spot ## Fill priority, center is best. Lower value is better # This is a strategy for the arranger. diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 30c0d06932..af23fcb4cf 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1284,7 +1284,7 @@ class CuraApplication(QtApplication): offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(node, min_offset = min_offset) # 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,_ = arranger.findNodePlacement(node, offset_shape_arr, hull_shape_arr, step = 10) op = AddSceneNodeOperation(node, scene.getRoot()) op.push() diff --git a/cura/MultiplyObjectsJob.py b/cura/MultiplyObjectsJob.py index f7bb3cf0fb..870f165487 100644 --- a/cura/MultiplyObjectsJob.py +++ b/cura/MultiplyObjectsJob.py @@ -49,10 +49,17 @@ class MultiplyObjectsJob(Job): arranger = Arrange.create(scene_root=root) offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(current_node, min_offset=self._min_offset) nodes = [] - + found_solution_for_all = True for i in range(self._count): # We do place the nodes one by one, as we want to yield in between. - nodes.append(arranger.findNodePlacement(current_node, offset_shape_arr, hull_shape_arr)) + node, solution_found = arranger.findNodePlacement(current_node, offset_shape_arr, hull_shape_arr) + if not solution_found: + found_solution_for_all = False + new_location = node.getPosition() + new_location = new_location.set(z = 100 - i * 20) + node.setPosition(new_location) + + nodes.append(node) Job.yieldThread() status_message.setProgress((i + 1) / self._count * 100) @@ -61,4 +68,8 @@ class MultiplyObjectsJob(Job): for new_node in nodes: op.addOperation(AddSceneNodeOperation(new_node, current_node.getParent())) op.push() - status_message.hide() \ No newline at end of file + status_message.hide() + + if not found_solution_for_all: + no_full_solution_message = Message(i18n_catalog.i18nc("@info:status", "Unable to find a location within the build volume for all objects")) + no_full_solution_message.show() \ No newline at end of file