multiplying objects place them in a grid

Co-authored-by: Casper Lamboo <c.lamboo@ultimaker.com>

CURA-7951
This commit is contained in:
saumya.jain 2023-08-21 18:51:08 +02:00
parent df69ccadb5
commit b91ebcbb36
2 changed files with 197 additions and 6 deletions

View file

@ -14,6 +14,7 @@ from UM.Operations.TranslateOperation import TranslateOperation
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.SceneNode import SceneNode
from UM.i18n import i18nCatalog
from cura.Arranging.GridArrange import GridArrange
from cura.Arranging.Nest2DArrange import arrange, createGroupOperationForArrange
i18n_catalog = i18nCatalog("cura")
@ -77,12 +78,17 @@ class MultiplyObjectsJob(Job):
found_solution_for_all = True
group_operation = GroupedOperation()
if nodes:
group_operation, not_fit_count = createGroupOperationForArrange(nodes,
Application.getInstance().getBuildVolume(),
fixed_nodes,
factor=10000,
add_new_nodes_in_scene=True,
lock_rotation=self._lock_rotation)
grid_arrange = GridArrange(nodes,Application.getInstance().getBuildVolume(),
fixed_nodes)
group_operation, not_fit_count = grid_arrange.arrange()
print("group_operation", group_operation)
# group_operation, not_fit_count = createGroupOperationForArrange(nodes,
# Application.getInstance().getBuildVolume(),
# fixed_nodes,
# factor=10000,
# add_new_nodes_in_scene=True,
# lock_rotation=self._lock_rotation)
found_solution_for_all = not_fit_count == 0
if nodes_to_add_without_arrange: