mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Multiplying now also gives a message if it could not find a suitable spot for some objects
This commit is contained in:
parent
f9fbd8c02e
commit
e26ade0e6f
3 changed files with 19 additions and 6 deletions
|
@ -84,11 +84,13 @@ class Arrange:
|
||||||
|
|
||||||
if x is not None: # We could find a place
|
if x is not None: # We could find a place
|
||||||
new_node.setPosition(Vector(x, center_y, y))
|
new_node.setPosition(Vector(x, center_y, y))
|
||||||
|
found_spot = True
|
||||||
self.place(x, y, hull_shape_arr) # place the object in arranger
|
self.place(x, y, hull_shape_arr) # place the object in arranger
|
||||||
else:
|
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))
|
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
|
## Fill priority, center is best. Lower value is better
|
||||||
# This is a strategy for the arranger.
|
# This is a strategy for the arranger.
|
||||||
|
|
|
@ -1284,7 +1284,7 @@ class CuraApplication(QtApplication):
|
||||||
offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(node, min_offset = min_offset)
|
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
|
# 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 = AddSceneNodeOperation(node, scene.getRoot())
|
||||||
op.push()
|
op.push()
|
||||||
|
|
|
@ -49,10 +49,17 @@ class MultiplyObjectsJob(Job):
|
||||||
arranger = Arrange.create(scene_root=root)
|
arranger = Arrange.create(scene_root=root)
|
||||||
offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(current_node, min_offset=self._min_offset)
|
offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(current_node, min_offset=self._min_offset)
|
||||||
nodes = []
|
nodes = []
|
||||||
|
found_solution_for_all = True
|
||||||
for i in range(self._count):
|
for i in range(self._count):
|
||||||
# We do place the nodes one by one, as we want to yield in between.
|
# 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()
|
Job.yieldThread()
|
||||||
status_message.setProgress((i + 1) / self._count * 100)
|
status_message.setProgress((i + 1) / self._count * 100)
|
||||||
|
|
||||||
|
@ -61,4 +68,8 @@ class MultiplyObjectsJob(Job):
|
||||||
for new_node in nodes:
|
for new_node in nodes:
|
||||||
op.addOperation(AddSceneNodeOperation(new_node, current_node.getParent()))
|
op.addOperation(AddSceneNodeOperation(new_node, current_node.getParent()))
|
||||||
op.push()
|
op.push()
|
||||||
status_message.hide()
|
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()
|
Loading…
Add table
Add a link
Reference in a new issue