mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 03:07:53 -06:00
Arrange All now places excessive objects outside build plate. CURA-3239
This commit is contained in:
parent
8f6a210c75
commit
ed0fb1b0ab
2 changed files with 15 additions and 9 deletions
|
@ -72,7 +72,7 @@ class Arrange:
|
||||||
self.place(x, y, hull_shape_arr) # take place before the next one
|
self.place(x, y, hull_shape_arr) # take place before the next one
|
||||||
else:
|
else:
|
||||||
Logger.log("d", "Could not find spot!")
|
Logger.log("d", "Could not find spot!")
|
||||||
new_node.setPosition(Vector(200, 0, 100 + i * 20))
|
new_node.setPosition(Vector(200, 0, 100 - i * 20))
|
||||||
|
|
||||||
nodes.append(new_node)
|
nodes.append(new_node)
|
||||||
return nodes
|
return nodes
|
||||||
|
|
22
cura/ArrangeObjectsJob.py
Normal file → Executable file
22
cura/ArrangeObjectsJob.py
Normal file → Executable file
|
@ -6,6 +6,7 @@ from UM.Scene.SceneNode import SceneNode
|
||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
from UM.Operations.SetTransformOperation import SetTransformOperation
|
from UM.Operations.SetTransformOperation import SetTransformOperation
|
||||||
from UM.Operations.GroupedOperation import GroupedOperation
|
from UM.Operations.GroupedOperation import GroupedOperation
|
||||||
|
from UM.Logger import Logger
|
||||||
from UM.Message import Message
|
from UM.Message import Message
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
@ -54,20 +55,25 @@ class ArrangeObjectsJob(Job):
|
||||||
start_priority = 0
|
start_priority = 0
|
||||||
best_spot = arranger.bestSpot(offset_shape_arr, start_prio=start_priority, step=10)
|
best_spot = arranger.bestSpot(offset_shape_arr, start_prio=start_priority, step=10)
|
||||||
x, y = best_spot.x, best_spot.y
|
x, y = best_spot.x, best_spot.y
|
||||||
last_size = size
|
node.removeDecorator(ZOffsetDecorator)
|
||||||
last_priority = best_spot.priority
|
if node.getBoundingBox():
|
||||||
|
center_y = node.getWorldPosition().y - node.getBoundingBox().bottom
|
||||||
|
else:
|
||||||
|
center_y = 0
|
||||||
if x is not None: # We could find a place
|
if x is not None: # We could find a place
|
||||||
|
last_size = size
|
||||||
|
last_priority = best_spot.priority
|
||||||
|
|
||||||
arranger.place(x, y, hull_shape_arr) # take place before the next one
|
arranger.place(x, y, hull_shape_arr) # take place before the next one
|
||||||
|
|
||||||
node.removeDecorator(ZOffsetDecorator)
|
|
||||||
if node.getBoundingBox():
|
|
||||||
center_y = node.getWorldPosition().y - node.getBoundingBox().bottom
|
|
||||||
else:
|
|
||||||
center_y = 0
|
|
||||||
grouped_operation.addOperation(SetTransformOperation(node, Vector(x, center_y, y)))
|
grouped_operation.addOperation(SetTransformOperation(node, Vector(x, center_y, y)))
|
||||||
|
else:
|
||||||
|
Logger.log("d", "Arrange all: could not find spot!")
|
||||||
|
grouped_operation.addOperation(SetTransformOperation(node, Vector(200, center_y, - idx * 20)))
|
||||||
|
|
||||||
status_message.setProgress((idx + 1) / len(nodes_arr) * 100)
|
status_message.setProgress((idx + 1) / len(nodes_arr) * 100)
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
|
|
||||||
grouped_operation.push()
|
grouped_operation.push()
|
||||||
status_message.hide()
|
|
||||||
|
status_message.hide()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue