Skip to content

Commit

Permalink
Merge branch '5.5'
Browse files Browse the repository at this point in the history
# Conflicts:
#	conanfile.py
  • Loading branch information
jellespijker committed Oct 10, 2023
2 parents 0f770ac + 57b581d commit 73900d3
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 212 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def validate(self):

def requirements(self):
self.requires("boost/1.82.0")
self.requires("curaengine_grpc_definitions/latest@ultimaker/testing")
self.requires("curaengine_grpc_definitions/(latest)@ultimaker/testing")
self.requires("zlib/1.2.13")
self.requires("pyarcus/5.3.0")
self.requires("curaengine/(latest)@ultimaker/testing")
Expand Down
7 changes: 3 additions & 4 deletions cura/Arranging/Arranger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Arranger:
def createGroupOperationForArrange(self, *, add_new_nodes_in_scene: bool = False) -> Tuple["GroupedOperation", int]:
def createGroupOperationForArrange(self, add_new_nodes_in_scene: bool = False) -> Tuple["GroupedOperation", int]:
"""
Find placement for a set of scene nodes, but don't actually move them just yet.
:param add_new_nodes_in_scene: Whether to create new scene nodes before applying the transformations and rotations
Expand All @@ -16,13 +16,12 @@ def createGroupOperationForArrange(self, *, add_new_nodes_in_scene: bool = False
"""
raise NotImplementedError

def arrange(self, *, add_new_nodes_in_scene: bool = False) -> bool:
def arrange(self, add_new_nodes_in_scene: bool = False) -> bool:
"""
Find placement for a set of scene nodes, and move them by using a single grouped operation.
:param add_new_nodes_in_scene: Whether to create new scene nodes before applying the transformations and rotations
:return: found_solution_for_all: Whether the algorithm found a place on the buildplate for all the objects
"""
grouped_operation, not_fit_count = self.createGroupOperationForArrange(
add_new_nodes_in_scene=add_new_nodes_in_scene)
grouped_operation, not_fit_count = self.createGroupOperationForArrange(add_new_nodes_in_scene)
grouped_operation.push()
return not_fit_count == 0
2 changes: 1 addition & 1 deletion cura/Arranging/GridArrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self, nodes_to_arrange: List["SceneNode"], build_volume: "BuildVolu

self._allowed_grid_idx = self._build_plate_grid_ids.difference(self._fixed_nodes_grid_ids)

def createGroupOperationForArrange(self, *, add_new_nodes_in_scene: bool = False) -> Tuple[GroupedOperation, int]:
def createGroupOperationForArrange(self, add_new_nodes_in_scene: bool = False) -> Tuple[GroupedOperation, int]:
# Find the sequence in which items are placed
coord_build_plate_center_x = self._build_volume_bounding_box.width * 0.5 + self._build_volume_bounding_box.left
coord_build_plate_center_y = self._build_volume_bounding_box.depth * 0.5 + self._build_volume_bounding_box.back
Expand Down
30 changes: 29 additions & 1 deletion cura/Arranging/Nest2DArrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import List, TYPE_CHECKING, Optional, Tuple

from UM.Application import Application
from UM.Decorators import deprecated
from UM.Logger import Logger
from UM.Math.Matrix import Matrix
from UM.Math.Polygon import Polygon
Expand Down Expand Up @@ -124,7 +125,7 @@ def findNodePlacement(self) -> Tuple[bool, List[Item]]:

return found_solution_for_all, node_items

def createGroupOperationForArrange(self, *, add_new_nodes_in_scene: bool = False) -> Tuple[GroupedOperation, int]:
def createGroupOperationForArrange(self, add_new_nodes_in_scene: bool = False) -> Tuple[GroupedOperation, int]:
scene_root = Application.getInstance().getController().getScene().getRoot()
found_solution_for_all, node_items = self.findNodePlacement()

Expand All @@ -149,3 +150,30 @@ def createGroupOperationForArrange(self, *, add_new_nodes_in_scene: bool = False
not_fit_count += 1

return grouped_operation, not_fit_count


@deprecated("Use the Nest2DArrange class instead")
def findNodePlacement(nodes_to_arrange: List["SceneNode"], build_volume: "BuildVolume",
fixed_nodes: Optional[List["SceneNode"]] = None, factor=10000) -> Tuple[bool, List[Item]]:
arranger = Nest2DArrange(nodes_to_arrange, build_volume, fixed_nodes, factor=factor)
return arranger.findNodePlacement()


@deprecated("Use the Nest2DArrange class instead")
def createGroupOperationForArrange(nodes_to_arrange: List["SceneNode"],
build_volume: "BuildVolume",
fixed_nodes: Optional[List["SceneNode"]] = None,
factor=10000,
add_new_nodes_in_scene: bool = False) -> Tuple[GroupedOperation, int]:
arranger = Nest2DArrange(nodes_to_arrange, build_volume, fixed_nodes, factor=factor)
return arranger.createGroupOperationForArrange(add_new_nodes_in_scene=add_new_nodes_in_scene)


@deprecated("Use the Nest2DArrange class instead")
def arrange(nodes_to_arrange: List["SceneNode"],
build_volume: "BuildVolume",
fixed_nodes: Optional[List["SceneNode"]] = None,
factor=10000,
add_new_nodes_in_scene: bool = False) -> bool:
arranger = Nest2DArrange(nodes_to_arrange, build_volume, fixed_nodes, factor=factor)
return arranger.arrange(add_new_nodes_in_scene=add_new_nodes_in_scene)
7 changes: 7 additions & 0 deletions resources/qml/Actions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,13 @@ Item
shortcut: fileProviderModel.count == 1 ? StandardKey.Open : ""
}

Action
{
id: arrangeSelectionAction
text: catalog.i18nc("@action:inmenu menubar:edit", "Arrange Selection")
onTriggered: Printer.arrangeSelection()
}

Action
{
id: newProjectAction
Expand Down
12 changes: 12 additions & 0 deletions resources/qml/Dialogs/ColorDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) 2023 UltiMaker
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.7
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.3
import QtQuick.Dialogs

// due for deprication, use Qt Color Dialog instead
ColorDialog
{
}
Loading

0 comments on commit 73900d3

Please sign in to comment.